Skip to main content

Guide to power query editor

Are you spending a big chunk of your time cleaning the data in excel? If yes then this blog is for you. All the cleaning and transforming of data can be achieved in Microsoft Power BI. Power BI offers a wide variety of options to clean your data. Power BI comes with a power query editor where you can play around with the data and I consider it as an ETL tool where you can transform your data according to the needs.

We have discussed the data cleaning process in the last blog and in today's blog the focus will be on transforming data and the features that the power query editor offers. These steps are solely subjective according to the data type and to your needs. I am highlighting 6 steps to transforming the data. I am working on the sample superstore data. So let's get started!!!!

  • Removing columns and rows- We are aware that the datasets can have a lot of unwanted columns and rows. To get better insights you need to get rid of it. To do so you need to select the column. If you need multiple columns at once then hold down the Ctrl key and select all the columns. On the home ribbon, you can find the remove column pane. Considering this dataset I am adding the returned data along with the order summary and you can see in the second picture that the headers are in rows. You need to select the tab "Use the first row as headers".



  • Checking the data type of each and every column because there are times where the columns are assigned with the wrong data type and can hamper the visualization. To do so if you toggle around every column on the left corner of every column you can find the data type assigned to that whole column. To change it you need to click it and you will get different options to select from. 

  • Splitting the columns- There are several instances where you need to split the column for eg. you need to separate the first name and last names of consumers then this is the befitted option. This is similar to text to columns in excel. In this dataset, I am finding out the acronym for different categories which is present in the Product_ID and we will split the acronym from there.


  • Replacing and removing null values- It is quite common to find a lot of null values when you are dealing with such big datasets. To get rid of such values you need to select one of the null values in a column and right-click where you get options to replace and remove such values. In this dataset, I am replacing the null values with a text.

  • Merging and appending the data- This feature is most discussed in the Power BI community and users can get confused at times whether to use merge or append. When we talk about the merge you need to combine the queries via a common column. It's not the case with appending queries if you need to add extra rows to your existing query then use append. In this case, we are merging the order summary query with return status, and Order_ID act as a common column for this. To do so you need to select the merge queries pane in the Home ribbon. It will open up a new toggle where you need the common column and the type of join you want. Normally I use left join.




  • Unpivoting the column- This is one of the most widely used features of the power query editor. It is quite similar to the Transpose formula in excel. In this dataset, we are adding the US population numbers. To do so we are scraping the data from the web


You will land up with the population data where you can remove unnecessary columns as suggested previously. After that, you need to switch to the transform pane where you can find the unpivot column. In that tab select the unpivot other columns

These are some of the basic steps which I followed to transform the data and you can observe the difference in the quality of insights you are going to generate if you implement such techniques. I haven't explored many features such as creating a data query that will help you to utilize all the time intelligence functions. Also, one great piece of advice would just check all the applied steps in the right of every query and you can undo any step with just one click. Power BI is very intuitive in nature and you won't find it difficult to try out all the offered features.  



Thanks for Reading  Let's connect on  LinkedIn.


Comments

Popular posts from this blog

Ultimate Beginners Guide to DAX Studio

There are zillions of external tools available with Power BI but DAX Studio is one of the most commonly used tools to work with DAX queries. It is a perfect tool to optimize the DAX and the data model. In this blog let's shed some light on the basic functionalities that can take your report to the next level. ARE YOU READY?  To start you will need the latest version of the DAX Studio. You can download it from their website . Don't worry you don't have to pay for the license. Fortunately, DAX Studio is a free tool As a BI Developer, I am using DAX Studio regularly. Based on my experience I use it for several purposes but in this blog, I will highlight the most common ones. Extracting a dump of all the measures used in your PBIX. Why do we need to do this? It can be used for documentation purposes also sometimes we try to reuse the DAX and such a dump comes in handy in this scenario. How to achieve it? Open the DAX Studio it is located under the external tools once you open t...

Identify and Delete Unused Columns & Measures

Heavy dashboards and a bad data model is a nightmare for every BI Developer. Heavy dashboards can be slow due to multiple reasons. It is always advised to stick with best practices. Are you still figuring out about those best practices then you should definitely have a quick read on Best Practice Analyser ( link ). One of the most common issues with slow dashboards is unused columns and unused measures.  It is very normal to load some extra columns and create some test measures in your dashboard but as a part of cleanup process those unused columns and unused measures should be removed. Why we are removing them? Because if you keep them then ultimately it will increase the size of your data model which is not a good practice.  How to identify the culprits (unused columns and unused measures)? In today's blog we will provide you with 2 most common external tools which will help you in identifying the culprits. More external tools😒. Who's going to pay for this? To your surprise...

Best Practice Analyser (BPA) Guide

Do you want to save tons of efforts to check if your data model and PBIX file follows the standard best practices and norms? Then this blog is for you. If you are a follower of our channel we already deep dive into the importance of the DAX Studio as an external tool. If you are a beginner I would highly recommend to visit this blog . In today's blog we will check how Tabular Editor can help to optimize the data model.  Best Practice Analyser allows to define or import best practices. It will make sure that we do not violate the best practices while developing a dashboard. Isn't it exciting!! Before we start make sure you already have Tabular Editor version 2.24.1 installed on your system. To install it do visit this link and select the link for windows installer. Once Tabular Editor is installed it will reflect in your PBIX file under external tool. Also, we need to define the standard rules. To do so in your advanced scripting or C# script copy this and save it via Ctrl+S. An...