Power Query Editor in Power BI
Last Updated :
02 May, 2025
Power Query Editor is a tool in Power BI Desktop used for data transformation and preparation. It allow to connect, shape and transform multiple data sources according to the user's needs. After making the desired changes the transformed data is then loaded to the Power BI desktop to fetch final outputs and reports. It can be in two modes as desktop or online.
When we upload data from various sources be it the internet, any Excel file or SQL server or any other source the uploaded data is not in the desired format. Data transformation helps clean and organize the data by removing unnecessary rows, splitting columns, and changing formats before loading it into Power BI for analysis.
Launching Power Query Editor
To open the Power Query Editor click Transform Data under the Home tab in Power BI Desktop. This will open the editor where you can load and transform your data.
Launching Power Query EditorNow we will add data to query editor to perform desired operations.
Importing Data
In the Power Query Editor click New Source to add data from different sources like Excel, SQL, or the web. After importing you can perform necessary transformations on the data. The data referred to here for illustration purposes is an Excel file named My movie list.xlsx and its data is as follows:
My Movie List.xlsxOn loading this data on the query editor it appears as:
Excel sheet in the power query editorNow since we have the Excel sheet and data imported on the power query editor as well we can perform transformations.
1. Renaming Elements
The power query editor provides us with a variety of possible renaming. We can rename the data sources or tables, columns and queries. We will look into each of them one by one.
Rename Data Source
It can be achieved by right-clicking on the source and opting for the rename option. Here, we have renamed the data source from sheet 1 to Movie Data. On transformation, we get :
Renamed source to "Movie Data"Rename Column
It's also done by right-clicking the column in which you wish to change the name and selecting the option of renaming and renaming as per the wish of the user. Here, we have renamed the column "TITLE" to "MOVIE NAME". On renaming the column it appears as :
Renamed column to "MOVIE NAME"Rename Query
Under the query settings pane an "Applied Steps" section under which all the changes we made are stored as queries. Using the query editor we can rename the queries also. Here, we have renamed the query "Renamed Columns" to "Columns Name Updation". On renaming it appears as :
Renamed query to "Columns Name Updation"This operation is used to set the first row as the column header. This option is available under the "TRANSFORM" of the ribbon. It has another option of "Use Headers as First Row" as well.
Set First Row as Headers3. Change Data Types of a Column in Power BI
To change a column’s data type in Power BI, right-click the column, select Change Type, and choose the appropriate data type (e.g., "Whole Number" to "Decimal Number"). For example, we changed the "RANK" column from whole numbers (1, 2, 3) to decimal numbers (1.2, 2.3, 3.4). You can also change data types from the Home tab under "Data type"
Changed data type to "Decimal Number"The Format feature in the Transform tab helps format text in Power BI. You can change text to uppercase or lowercase, add prefixes or suffixes, and remove leading or trailing spaces using the Trim option. The Clean option removes non-printable characters. To use these simply click the relevant option. In this example we applied the UPPERCASE transformation but the other options work the same way.
Formatting the text to UPPERCASE5. Removal Operation in Power BI
Remove Row Operation
The Reduce Rows feature in the Home tab allows you to remove rows in Power BI. You can remove top, bottom, or alternate rows, as well as duplicates, blank rows and errors. For example you can easily remove the bottom row and other removal operations work in the same way.
Removing the bottom row
"Reduce Rows" BlockPlease note that the "Reduce Rows" block in Power BI offers two options: "Remove Rows" and "Keep Rows". We have illustrated the "Remove Rows" operation above. On the same lines the "Keep Rows" operation is performed. The "Keep Rows" feature lets you select the rows you want to keep while "Remove Rows" deletes unwanted rows.
Remove Column Operation
The Remove Columns feature allows you to delete one or more columns. It's found under the "Home" tab in the Manage Columns section. You can click "Remove Columns" to delete the selected column or use "Remove Other Columns" to delete all columns except the one you selected. For example if you remove the "RATING" column it will no longer appear in your data.
Removing Column RatingOutput:
"RATING" column has been successfully removed.
"Manage Columns" blockThe Manage Columns block has two features: Choose Columns and Remove Columns. Choose Columns lets you keep the columns you want while Remove Columns lets you delete the ones you don't need.
6. Merge Operation in Power BI
We can merge multiple columns. To select multiple columns hold down the Ctrl key, navigate to the columns you want to be selected using the left and right arrows, and then press the Space bar to actually select those columns. The "Add Column" bar supports the "Merge Columns" feature which is followed by a prompt of merge columns that asks for the name of the merged column and to set the separator. Here, we have merged the columns "GENRE" and "RATING". We have used a custom separator " ;) " and kept the name of the merged column simple as "Merged". The illustration along with the output is as follows :
Merging Columns GENRE and RATINGOutput:
Merged ColumnReplace Values Operation in Power BI
Replace values operation replaces some specific value to our desired value. It's present in the "Transform" bar as "Replace Values". Here, we have replaced "null" to "geeksforgeeks" for column "GENRE".
Replacing values of column "GENRE"
Replacing "null" to "geeksforgeeks"Output:
Successfully Replaced
Split Column Operation in Power BI
It's present in the "Transform" bar on the ribbon. In the transform bar lies an operation as "split column". We can split either by using a delimiter, by providing no. of characters or positions, and so on. Here, we have split the column "Merged" using the customized delimiter " ;) " that splits the column into two columns "Merged.1" and "Merged.2". The illustration is as follows :
Splitting column "Merged"Before
Before Split ScenarioAfter
After Split ScenarioParticularly for PIVOT and UNPIVOT operations, we will refer to some other examples as the data we have been using so far will produce huge output and would not be so comprehensible and also can't be uploaded here.
Pivot Column Operation in Power BI
The pivot operation basically turns rows into columns. By default, the query editor does sum as aggregation which can also be set as don't aggregate or minimum or maximum or whatever as per the user's wish from available options. It is present in the "Transform" bar.
Pivot column "Field 2"In the output we see 9.3 corresponding to 2 and not multiple values such as 1.1, 4.3, and 3.9. It's because we have set the aggregate value function as sum i.e. it will sum all the values of 1.1, 4.3, and 3.9 which is "9.3". Also, for 3 and 9 we have no repetitions so data corresponding to them is shown as "2.6" for each respectively.
Unpivot Column Operation in Power BI
Unpivot column operation as the name also suggests does the opposite of what pivot does. Unpivot basically unpacks similar values and gathers them under one label. When we did unpivot on the same data we took for the pivot operation it produces the output:
Unpivot operation implemented on Field 1 and Field 2 bothOutput:
On unpivoting both the columns
Similar Reads
Power BI - How to edit in Power BI App?
Power BI is a data visualization application that lets you connect, transform and find insights into the most pressing matters of your business. It helps in sourcing your data and creating visual dashboards, KPIs, and reports by editing the data as per your concerns. You can collaborate, share and i
8 min read
Power BI Tutorial | Learn Power BI
Power BI is a Microsoft-powered business intelligence tool that helps transform raw data into interactive dashboards and actionable insights. It allow users to connect to various data sources, clean and shape data and visualize it using charts, graphs and reports all with minimal coding.Itâs widely
5 min read
Power BI - Use Top N Filters
The top N filters, property enables users to see the top results of numeric data, the numeric data can be a sum, average, count, min, etc. One can view and display the other properties of the dataset, by setting a top filter bar to numeric data. The top N filters property is similar to SQL TOP N fun
2 min read
Data refresh in Power BI
Data refresh means to update your reports and dashboards with the latest data from your sources. When your data changes like new sales numbers, customer records or website visits you don't have to rebuild your reports. Instead Power BI can pull the new data for you automatically or whenever you need
3 min read
Data types in Power BI
Data types are basic building blocks of our dataset. They define what kind of information is stored in each column making it easier to organize and analyze your data. Power BI supports different data types each made for a specific purpose. In this article, we will understand them one by one with exa
5 min read
Editing Power BI Report Interactions
Power BI is a platform that is used to connect, visualize, and share data with other users. It is a business analytics and data visualization tool that converts data from sources extracts information from that data and represents it in interactive visualizations and reports. In this article, we will
10 min read
Merge and Append Queries in Power BI
Power BI is a popular data visualization tool that can be used to create interactive reports and dashboards. It can work on different types of data. A key feature to be noted is its ability to combine multiple data. The merging and appending functions in Power BI let you combine data from several ta
7 min read
Data Modeling in Power BI
In todayâs world, âdata is the new oilâ. Data modeling is the process of creating visual representations of multiple tables or dataset connections. These datasets have attributes and fields with relevant information. A data model is an organized visual representation of different data elements, thei
9 min read
Power BI - Pin Report to a Dashboards
Dashboards are used to display specific data, part of a report, a filter, etc. Reports and Dashboards are two different things, and most of the time people mix them. A power BI report in general is built into the power bi desktop, while dashboards are a part of the power bi service, and they don't h
2 min read
Power BI - Decomposition Tree
In this article, we will learn to implement decomposition charts using Power BI. This discusses some important concepts used to create the very common decomposition tree charts so as to make large business data analysis. We will be discussing the following topics and their implementation in the Powe
7 min read