DAX vs Power Query: What's the Difference in Power BI?
DAX vs Power Query in Power BI: learn when to prepare data with Power Query and when to calculate with DAX, using a comparison table and examples.
Table of Contents
- What Is Power Query in Power BI?
- What Is DAX in Power BI?
- DAX Basics: Measures, Columns and Tables
- Filter Context in Plain Words
- DAX vs Power Query: Side-by-Side Comparison
- Core Differences Explained
- Timing: Load Time vs Report Time
- Model Size, Refresh and Query Folding
- Where SQL Fits
- Same Task, Two Ways
- Power Query custom column (M):
- DAX calculated column:
- Practical Example: Clean, Then Calculate
- In Power Query:
- In DAX, once the clean table has loaded:
- DAX vs Power Query: How to Choose the Right Tool
- Common Mistakes When Using Both Tools
- How to Learn Both in the Right Order
- Conclusion
Open Power BI Desktop and you meet two tools that both seem to “change data”: the Power Query Editor and the DAX formula bar. Beginners often use one where the other belongs, and the result is a bloated model or a report that shows the wrong total the moment a slicer moves. The real DAX vs. Power Query question is simple: should the work happen before the data loads, or after?
Below, we break down DAX vs. Power Query with a comparison table, one dataset handled both ways, and a quick test you can apply to any task.
What Is Power Query in Power BI?
Power Query is the data preparation engine inside Power BI. According to Microsoft’s overview of Power Query, you connect to a source, shape the data in the Power Query Editor, and each action you take is saved as a step. Behind the scenes, Power Query writes the M code for every step, so you rarely have to type it yourself.
Everyday preparation work includes:
- Removing duplicate rows and blank records
- Fixing data types, such as text to date or text to number
- Splitting or merging columns
- Appending monthly files or merging two tables
- Unpivoting wide tables into a tidy layout
Saved steps replay on every refresh, so next month’s file gets the same treatment automatically. We keep the detailed cleaning walkthrough on its own page; if you are new to this stage, start with this data cleaning tutorial for beginners.
What Is DAX in Power BI?
DAX stands for Data Analysis Expressions. As Microsoft’s DAX overview explains, it is the formula language used across Power BI, Analysis Services and Power Pivot in Excel. It sits behind totals, ratios, rankings and year-to-date comparisons; in short, any number that depends on what the viewer selects.
In a DAX vs Power Query comparison, think of it this way: Power Query decides which rows and columns exist, and DAX decides what to calculate from them.
DAX Basics: Measures, Columns and Tables
- Measures: calculated on demand, so each cell in a visual gets its own result.
- Calculated columns: a DAX formula runs once per row during refresh, and the answers are stored in the model like any other column.
- Calculated tables: whole new tables built from a DAX expression over data you already have.
Filter Context in Plain Words
Filter context is the set of selections a formula sees at the moment it runs: slicer choices, report filters, and the row or column of the visual it sits in. Take Total Sales = SUM(Sales[Amount]). In a card, it returns the total. In a table split by region, the same formula returns a different figure on each row, because each row applies its own region filter. Pick “North” in a slicer, and every cell narrows to North. CALCULATE is the function that lets you add, remove or replace those filters deliberately, which is why most DAX basics lessons spend so much time on it.
Measures click fastest when they drive real numbers, as in this KPI dashboard tutorial.
DAX vs Power Query: Side-by-Side Comparison
| Feature |
Power Query |
DAX |
| Main purpose |
Prepare and reshape data |
Calculate and analyse data |
| Workflow stage |
Before data loads into the model |
After data is in the model |
| Language |
M (mostly generated by clicks) |
DAX formulas (typed) |
| Typical output |
Clean, structured tables |
Measures, calculated columns, calculated tables |
| Reacts to slicers? |
No, it runs at refresh |
Measures do; calculated columns do not |
| Typical tasks |
Remove duplicates, change types, merge, unpivot |
Totals, ratios, YTD, rankings, % of total |
| Learning curve |
Gentler, largely point-and-click |
Steeper, needs filter context |
Core Differences Explained
Timing: Load Time vs Report Time
The biggest difference is when each tool does its work. Power Query runs at refresh and hands the model a finished table. Measures run while someone is using the report. Calculated columns sit in between: they are computed at refresh, then stored.
Model Size, Refresh and Query Folding
Because calculated columns are stored in the model, building many of them for jobs that Power Query could do upstream adds weight. With database sources, Power Query can often push steps back to the source, a behaviour called query folding, which may keep refreshes efficient; support depends on the source and the step.
Where SQL Fits
If your data already lives in a database, part of the cleaning may belong there instead. The trade-offs are covered in this comparison of SQL vs Power Query for data cleaning.
Same Task, Two Ways
Some jobs can be done in either tool, which is where confusion peaks. Suppose your Sales table contains Quantity and Unit Price fields, and you want the total amount for each sale.
Power Query custom column (M):
[Quantity] * [Unit Price]
DAX calculated column:
Line Total = Sales[Quantity] * Sales[Unit Price]
Both return the same number. The Power Query version keeps row-level logic beside your other cleaning steps. Choose DAX when the value needs a relationship, for example, a price held in another table. Often the better answer is neither: a measure such as Total Revenue = SUMX(Sales, Sales[Quantity] * Sales[Unit Price]) avoids storing an extra column at all.
M has functions for the cleaning jobs listed earlier. Removing duplicate orders, for instance, is written as Table.Distinct(Source, {"OrderID"}); the Table.Distinct reference shows its options. If you click Remove Duplicates in the editor, Power Query writes this same function for you.
Practical Example: Clean, Then Calculate
Here is how the DAX vs Power Query split looks on a retail sales file (an illustrative scenario) with duplicate orders, dates stored as text and a customer column mixing first and last names.
In Power Query:
- Remove duplicate order rows.
- Change the order date from text to a date type.
- Replace blank regions with “Unknown”.
- Split the customer name into two columns.
In DAX, once the clean table has loaded:
Total Sales = SUM(Sales[Amount])
Order Count = DISTINCTCOUNT(Sales[OrderID])
Average Order Value = DIVIDE([Total Sales], [Order Count])
Sales YTD = TOTALYTD([Total Sales], 'Date'[Date])
Time intelligence such as TOTALYTD works best with a proper date table: one row per day, marked as the model’s date table. Microsoft explains how to set up a date table in Power BI Desktop.
DAX vs Power Query: How to Choose the Right Tool
If you are stuck on DAX vs Power Query for a particular task, ask one question: should this result change when a user clicks a slicer? If yes, use DAX. If not, it probably belongs in Power Query.
| Task |
Usually best in |
| Remove duplicates or errors |
Power Query |
| Fix data types |
Power Query |
| Combine files or tables |
Power Query |
| Unpivot columns |
Power Query |
| Percentage of total |
DAX |
| Year-to-date or previous-year comparison |
DAX |
| Ranking that depends on filters |
DAX |
| Average, ratio or conversion rate |
DAX |
The grey area is the new column. A fixed attribute of each row, such as a cleaned category, belongs in Power Query. A value that depends on relationships or other tables may suit DAX. “Usually” matters here, because real projects have exceptions.
When you meet an unfamiliar function, Microsoft’s DAX function reference lists each one with syntax and examples.
Common Mistakes When Using Both Tools
Most DAX vs Power Query mix-ups fall into a few patterns:
- Cleaning with DAX columns. Fixing text-formatted dates in a calculated column leaves the broken original column in the model, and every page now depends on a workaround.
- Summarising too early in Power Query. Grouping rows before loading removes detail, so measures can no longer respond to slicers.
- Ignoring data types. A date stored as text breaks time-based measures before DAX even starts.
- Leaving default names. “Added Custom1” and “Measure 7” confuse the next person, usually you.
- Skipping the data model. Correct formulas still return odd results when relationships are wrong.
How to Learn Both in the Right Order
Treat DAX vs Power Query as a sequence, not a rivalry. If you are still choosing a platform, read this Power BI vs Tableau vs Looker Studio comparison first.
- Start with Power Query. Connect a file, fix the data types and remove obvious errors.
- Build a simple model. Load the clean tables and set up relationships.
- Write five measures. Sum, count, average, a ratio and one year-to-date calculation.
- Rebuild a report you already use. Real numbers expose mistakes quickly, and a Power BI dashboard tutorial can guide the finishing touches.
- Go deeper into filter context. Practise CALCULATE with a few different filters.
Guided practice shortens trial and error. According to its course page, SPARC’s Data Analytics Course with AI covers Excel, SQL, Python, Power BI and Tableau over eight months, with 40+ projects.
Conclusion
The DAX vs Power Query decision gets easier once you separate the jobs: shape the data first, then calculate on it. Power Query gives you clean, reliable tables, and DAX turns them into answers that move with the viewer’s choices. Keep that order, and your models stay lighter and your reports easier to maintain.
Already comfortable in spreadsheets? This guide on Power BI vs. Excel for data analysis shows when each one earns its place.
FAQs
Power Query prepares data before it loads, while DAX calculates on it after it loads, so only DAX measures respond to slicers.
Not really. DAX can create columns and tables, but cleaning and reshaping are better kept in Power Query, where steps replay on every refresh and your model stays lighter.
Most learners find DAX harder because it needs an understanding of filter context. Power Query is largely visual, so beginners usually feel productive in it sooner.
Power Query. Clean, correctly typed data makes DAX far easier to learn, because your formulas are not fighting messy columns.
No. Most Power BI reports use both, each at a different stage: Power Query to prepare the data, DAX to measure it.
If the value depends only on the same row, Power Query is usually tidier. If it needs other tables or filter context, DAX may fit better, and a measure can often avoid the column entirely.
No. M is the language behind Power Query’s transformation steps, while DAX is the formula language for calculations in the model. They have different syntax and different jobs.
No. Microsoft also provides it in Excel and in dataflows. DAX is used in Power BI, Analysis Services and Power Pivot in Excel.