What is Power Query in Power BI: Simple Explanation and Uses
Power Query in Power BI is a tool that helps you get, clean, and shape data before using it in reports. It works like a friendly assistant that prepares your data by applying steps you choose, so your reports show exactly what you want.How It Works
Think of Power Query as a kitchen where you prepare ingredients before cooking a meal. You bring raw data from different places like Excel files, databases, or websites. Then, you clean and shape this data by removing unwanted parts, fixing errors, or combining tables.
Power Query records each step you take, like peeling or chopping vegetables, so you can repeat the process anytime with new data. This makes your data ready and tidy for Power BI to create visuals and reports.
Example
This example shows how Power Query can filter a table to keep only sales above 1000 and add a new column with a 10% bonus.
let Source = Table.FromRecords({ [Product="Pen", Sales=500], [Product="Notebook", Sales=1500], [Product="Eraser", Sales=1200] }), FilteredRows = Table.SelectRows(Source, each [Sales] > 1000), AddedBonus = Table.AddColumn(FilteredRows, "Bonus", each [Sales] * 0.1) in AddedBonus
| Product | Sales | Bonus |
|---|---|---|
| Notebook | 1500 | 150 |
| Eraser | 1200 | 120 |
When to Use
Use Power Query when you need to prepare data before analysis. It is perfect for cleaning messy data, combining information from multiple sources, or changing data formats. For example, if you get monthly sales data in different files, Power Query can combine and clean them automatically.
This saves time and ensures your reports always use fresh, accurate data without manual work.
Key Points
- Power Query helps you get and prepare data easily without coding.
- It records each step so you can refresh data with one click.
- Supports many data sources like Excel, databases, and web.
- Transforms data by filtering, merging, adding columns, and more.
- Essential for clean, reliable data in Power BI reports.