Power Query is the data preparation engine built into Power BI, and you use it to connect to a source, clean and reshape the data, and load the result into your model. The short version: open Power BI Desktop, click Get data, pick your source, then use the Power Query Editor to transform columns and tables, and finally click Close & Apply to load the cleaned data. Everything you do in Power Query is recorded as a repeatable set of steps, so when the source refreshes, the same cleaning runs again automatically.

This guide covers the desktop workflow, since Power Query Editor is a Power BI Desktop tool. The Power BI service (the browser version) can refresh and schedule data but does not give you the full Power Query editing experience, so all shaping happens in Desktop before you publish. Menu labels can differ slightly by version and region, so if a name does not match exactly, look for the closest equivalent.

What You'll Need

  • Power BI Desktop installed from Microsoft's official download page (the Microsoft Store version works too).
  • A data source you can reach: an Excel or CSV file, a folder, a database, a SharePoint list, or a web page.
  • Credentials for that source if it requires sign-in.
  • A basic idea of what your finished table should look like: which columns, what types, and what counts as one row.

Step-by-Step

  1. Start a blank report. Open Power BI Desktop and close the splash window. You will see the Report view with a blank canvas.
  2. Connect to your data. On the Home ribbon, click Get data and choose your source type from the list (for example Excel workbook, Text/CSV, Folder, Web, or a database connector). If you do not see your source, use More to browse the full connector list.
  3. Pick the file or object. Navigate to the file or enter the server and database details, then confirm. For an Excel workbook, a Navigator window appears listing sheets and tables; tick the ones you want and click Transform Data rather than Load. Transform Data opens Power Query Editor so you can clean before loading.
  4. Check the applied steps. On the right side of Power Query Editor is the Applied Steps list. Every action you take is recorded there in order. Click any step to preview the data at that point, and use the X beside a step to delete it if you change your mind.
  5. Set data types. Look at the icon to the left of each column header. A wrong type (text where you expect a date or a whole number) breaks sorting, filtering and relationships later. Click the icon and choose the correct type. Dates in particular often arrive as text depending on your source's locale.
  6. Remove what you do not need. Select unneeded columns (Ctrl+click for several), right-click and choose Remove Columns. Removing columns early makes every later step faster. Use Remove Rows > Remove Blank Rows or Keep Rows > Keep Top Rows where appropriate.
  7. Clean the values. Right-click a column header for Transform options: Trim removes stray spaces, Clean removes non-printable characters, and Replace Values fixes inconsistent entries (for example "NY" versus "New York"). Use Split Column when one field holds two pieces of information, such as a full name or a combined address.
  8. Rename columns. Double-click a header and give it a clear, short name. This name becomes the field name in your report, so avoid duplicates and leading spaces.
  9. Unpivot if your table is wide. If month or category names sit across the top as column headers, select the columns that identify a row, right-click, and choose Unpivot Other Columns. This turns the wide layout into a tall one that Power BI can aggregate properly.
  10. Combine queries if needed. Use Home > Append Queries to stack tables with the same columns (for example monthly files), or Merge Queries to join on a matching key column. Choose the join kind carefully; the default inner join drops rows without a match.
  11. Name the query. In the Queries pane on the left, right-click the query and choose Rename. A meaningful name keeps the model readable.
  12. Load the result. Click Close & Apply on the Home ribbon. Power Query runs all steps and loads the output into the data model. If you only want the query available for reuse without loading it, right-click it and untick Enable load.
  13. Verify and refresh. Back in Report view, check the Data pane for your table and fields. Click Refresh on the Home ribbon to confirm the query re-runs cleanly against the source.

Common Mistakes

Loading before transforming. Clicking Load straight away means dirty data lands in the model and you have to redo the work. Always use Transform Data first.

Ignoring data types. Leaving a date or number column as text causes relationship errors and broken visuals later. Set types deliberately, not by accepting whatever the source guessed.

Deleting steps out of order. Removing an early step can invalidate later ones and produce errors. Work from the bottom of Applied Steps upward when troubleshooting.

Building a wide table. Keeping one column per month or category makes measures awkward. Unpivot to a tall structure instead.

Hard-coding a file path. Pointing at a single file breaks when the file moves. Use the Folder connector and filter by file name or extension so new files are picked up automatically.

Tips

Do the cheap steps first: remove columns and filter rows before splitting or merging, so later steps process less data. Give every query a clear name and group related queries in folders using right-click > Move to Group. Add a step description by right-clicking a step and choosing Properties, which helps whoever maintains the report. Keep a staging query that does the raw cleanup and separate queries that reference it for different outputs, so one fix propagates everywhere. When a transformation is repetitive, check whether a built-in command exists before writing custom logic; the recorded steps are easier to audit. Finally, test with a small sample first, then point the query at the full dataset once the logic is right.

Troubleshooting

If a step shows an error, click the step and read the message in the preview area. A common cause is a type mismatch, so check the column's data type and the source's locale settings for dates and decimals.

If refresh fails with a credentials error, go to File > Options and settings > Data source settings, select the source, and edit or clear permissions, then sign in again. Clearing credentials only removes the saved sign-in; it does not delete data.

If numbers or dates appear wrong after loading, the source is probably being read in the wrong locale. Set the correct locale in the query's source step or in the file origin options.

If columns are missing, confirm the source file has not changed structure and that no earlier step renamed or removed them. If a merge returns fewer rows than expected, switch the join kind to a full outer join to see which keys fail to match.

If Power BI Desktop is slow or unresponsive during shaping, close other heavy applications, reduce the preview row count in the editor settings, and simplify steps. If problems persist, restart Desktop and reopen the file before rebuilding anything.

Frequently Asked Questions

Is Power Query the same as Power BI?

No. Power Query is the data preparation component inside Power BI Desktop. Power BI is the wider product that also includes modelling, visuals and publishing.

Can I edit queries in the Power BI service?

The service supports refresh and some limited changes, but full Power Query editing happens in Power BI Desktop. Publish from Desktop after shaping the data.

Do my steps run every time I refresh?

Yes. The Applied Steps are replayed in order on each refresh, which is why a query that works once will keep working as the source updates.

How do I undo a transformation?

Delete the step in the Applied Steps list, or use the undo arrow in the editor. Deleting a step does not affect the original source file.

Why does my query load a table I did not want?

Every query with load enabled becomes a table. Right-click the query and untick Enable load to keep it as a helper only.

Can Power Query combine files from a folder?

Yes. Use the Folder connector, then Combine Files to append same-structured files, or transform the sample query manually for more control.