Jul 31, 2025
These are twelve DAX formulas that every Power BI report creator must know to create better reports - with examples, use cases and tips.
These are twelve DAX formulas that every Power BI report creator must know to create better reports - with examples, use cases and tips.
There are two kinds of Power BI data analysts – those who can get insights from incomplete datasets, and…
DAX is the secret sauce that makes Power BI probably the best business intelligence platform in the world. Think Excel formulas, but way more powerful and at a larger scale. By mastering DAX, you will be able to:
This article is intended for aspiring Power BI report creators, and we will list, explain and visualize twelve must-know DAX expressions that will serve as a solid foundation for your journey into the world of Power BI. If you want to learn even more about DAX in Power BI, we recommend checking out the following resources:
CALCULATE([expression], [filter1], [filter2])
CALCULATE changes the context of a calculation. Think of it as saying “Do this, but only for specific data.” It will evaluate your expression (like SUM, DIVIDE, etc.) but within a new condition.
Your report is showing global sales, but you need to limit this data to just one region – Europe. To achieve this, the CALCULATE expression will calculate the sum from ‘Sales[Amount]’ column, but only for rows where ‘Sales[Region]’ is Europe.
SUMX([table], [expression])
Whereas SUM will calculate the total value of a single column, SUMX will go row by row to calculate values from one or multiple columns using your expression, and then add them all up.
You want to find out the total sales amount, but your data has only ‘Sales[Quantity]’ and ‘Sales[Unit Price]’ columns. Here, we multiplied sale quantity with unit price to determine the sales income for each row, and SUMX will then add them all up to get the total sales amount for the column.
ALL([table])
When you need to always get the total column value, putting ALL in the expression will ensure that filters or slicers are ignored and your measure returns the grand total across all rows within the column.
In this CALCULATE expression, ALL ensures that you see the total sales amount globally, even if the user applies a filter to a specific region or product. Useful if you want to show it as a KPI card or use it in another expression that must have the global value.
DIVIDE([numerator], [denominator], [fallback value])
It does literally what it says on the tin – divides one number with another. But, to prevent errors in cases where the denominator is zero, NaN, or missing, there is also a fallback value that will be returned instead of a divide-by-zero error.
You are calculating Average Order Value by dividing Sales[Amount] by Sales[Quantity]. However, if a row has no sales, then instead of breaking the visual (since you can’t divide revenue by zero orders), the visual will return your provided fallback value.
Here, we used “No Data” as the fallback value instead of 0. In this scenario, 0 would mean no revenue at all; and if there is sales revenue but no units sold, it would imply that you received money without selling any product – bad news for the accounting department. Whereas “No Data” calls attention to the fact that there is missing data for this row.
ADDCOLUMNS([table], "new column name1", [expression 1], "new column name2", [expression 2], ...)
This function will add new calculated columns to your existing table. You can provide a name for the new column and enter an expression which will be used to fill in the values – such as the ones described above or many more.
Unlike measures, which are usually used to perform on-the-fly calculations and visualize quick insights, calculated columns go on a row-by-row basis and will be a permanent, fully-fledged part of the table.
Your Sales table has Sales[Cost] column with unit costs, and Sales[Amount] with sales revenue. You want to show profit for each sale – so with ADDCOLUMNS, the new column “Profit" will subtract Cost from Amount.
ADDCOLUMNS(Sales, "Profit", Sales[Amount] - Sales[Cost])
SELECTCOLUMNS([existing table], "new column name1", [expression1], "new column name2", [expression 2], ...)
SELECTCOLUMN works similarly to the previously described ADDCOLUMNS, but instead of adding new columns to an existing table, it will create a brand-new table. It will contain just your selected columns – copied as-is or with applying your provided expressions.
Our ‘Sales’ table has many columns we don’t need, and we want to reduce it to just two: Customer ID and Amount. SELECTCOLUMNS will do just that.
SUMMARIZE([table], [category column], "new summary column name", [expression])
This one is crucial for simplifying your data model, reducing the query sizes and improving report performance. SUMMARIZE will group your data using one or more category columns (e.g. “Region”, “Segment”, “Datetime” etc.) and create a new table which has only summarized values, instead of referencing the entire table. If you have used pivot tables in Excel, this will be very familiar.
In our fact table, we have a row for every single purchase. We don’t need that; we just want a summarized table that shows the average product sale price per each country so we can improve the pricing strategy for each market.
So, the new table will have a row for each country name in the Sales[Country] column, and it will take all rows for each country and divide their total ‘Amount’ with ‘Quantity’. The expression in our example uses the previously discussed DIVIDE, but you can use other expressions in its stead to achieve your desired results.
FILTER([table], [condition])
You have a table of all data, and you need to quickly create a filtered table that has only rows that match a specific condition. The new table will keep rows where your condition is true (like numeric values or matching text) and omit those where it is false.
One way to use FILTER is by matching text strings using the “=” operator; for example, Sales[Country] = “United States” to see only sales made in the USA. Or you can use a numerical column for the condition – here, we wanted to create a table with only high-paying customers, so FILTER kept only rows where ‘Amount’ exceeded 500$. All columns from the original table were copied to the new one, but only for rows that matched our condition.
RELATED(table[column])
If your data model has relationships between multiple tables, you will most likely run into scenarios where you want to reference a column from a different table. RELATED will fetch a value from a related table into the current one based on the relationship.
Let's return back to FILTER that we previously discussed: you can use RELATED in cases where you need to use data from another table in your filter. For example, you are storing data about customers – region, country, name, etc. – in a different dimension table, and you want to use that data to filter your fact table of all your sales (e.g. create a table with only sales in Asia).
IF([condition], [outcome if true], [outcome if false])
‘If’ statements are the cornerstone of almost any programming language, and DAX is no exception. It will check the value against your defined condition and give one result if the condition is met, and another result if it’s not.
You want to tag each sale as ‘High’ or ‘Low’ based on its value – if it is above $250, then it is high, but if it is below that, it is low. IF will check each value and return the correct label. The expression consists of the condition, output when the condition is met, and output if it is not met.
SWITCH([expression], [condition1], [outcome 1], [condition 2], [outcome2], ..., [else outcome])
When you want to have multiple conditions, you don’t need to create additional IF expressions for each. SWITCH allows you to stack multiple conditions and outputs in one expression. Basically, if the condition 1 is met, do one thing, otherwise check if the condition 2 is met and do another thing; and for the rest of values, do something else.
In the previous example with IF, we could only categorize sales in two categories – high and low. But with SWITCH, we can add more tiers – now, values above $500 will return “Very High”, anything between 251 and 500 is “High”, deals between 101 and 250 are “Medium”, and everything else is “Low”.
The latter example used ‘more-than’ (>) symbol, but you can use other operators as well. For example, with ‘equal to’ (=) operator, SWITCH can also be used to find exactly matching rows and apply the condition only to them.
RANKX([column], [expression])
RANKX assigns a rank to each row based on the value of a given measure. It will go through all rows in the column and return a number starting from 1 (largest value).
You want to know which countries have the most total sales. RANKX will go through each country in the Sales[Country] column and assign a rank number based on Sales[Total Sales] column values, so you can sort them to see a leaderboard of your best-performing markets.
One way to use this is to create custom rank-based sorting order for visualizations. While most column or bar chart visuals already sort columns by default based on series values, RANKX could be used in cases where you want to use other metrics for sorting or use a measure that combines multiple values. You can then add the new measure to one of the 25 ‘Series’ fields in Combo PRO and select it for sorting purposes (and hide it from the chart if you want).
These twelve essential DAX formulas are a great starting point for Power BI report creators, and with these, you can start building reports that deliver more insights than the ones present in the dataset. You can filter data based on context, perform calculations across multiple columns or even tables for new metrics, and automate bucketing or labelling.
Of course, to let your measures, calculated columns or filters truly shine, you need advanced visuals for your reports – and with Drill Down Visuals by ZoomCharts, you can use seamless cross-filtering, multiple drill down levels and endless customization options to create the most insightful and intuitive reports.
DAX is the language that is used to perform calculations and transform data in Power BI.
While both are similar and can use DAX expressions to perform calculations, measures return values on-demand (i.e., when a visual requests them) whereas calculated columns exist as part of the table and are calculated on report load.
To create a new DAX measure, press the New Measure button in the Home tab of Power BI Desktop’s top ribbon. You will be able to enter your desired DAX expression and create a measure. Another way to do that is by right-clicking in the Data pane on the right side and selecting New Measure (or New Column if you want a calculated column instead).
For this, you can use DIVIDE –provide the first column as numerator and the second column as denominator, and the division between will be returned as a decimal (e.g. 150 / 200 = 0.75). In the top ribbon, set the format to Percentage, and 0.75 will be converted to 75%.
Subscribe to our newsletter and be the first to read our latest articles and expert data visualization tips!