DAX Cheat Sheet for Beginners
This cheat sheet will show you the most used DAX functions and operators that can be combined to build formulas and expressions in a more effective way.
Quick DAX References
Download the DAX Cheat Sheet
DAX Beginner Tutorial Video The best interactive video to start when learning DAX. Learn the DAX fundamentals as well as topics like row context, the CALCULATE function and context transition.
- Introduction to DAX - Subscription required
- Advanced DAX - Subscription required
- DAX for Paginated Reports - Subscription required
- Understanding DAX Concepts With Power BI - FREE!
DAX Cheat Sheet
Problem | Calculation Expression |
---|---|
Total Sales Calculation | Calculated measure using SUM to aggregate a column.
|
Total Cost Calculation | Calculated measure using SUM to aggregate a column.
|
Profit Calculation | Calculated measure using two previously created calculated measures to determine profit.
|
Profit Margin | Calculated measure using two previously created calculated measures to determine profit margin, the DIVIDE function is used to perform the division.
|
Transaction Count | Calculated measure that returns a count of all rows in a table, ultimately, many times this simple calculation is used to return transaction counts.
|
Related Table Count | Returns the total rows in a related table. For example, total transactions by Product.
|
Month To Date Sales
Problem | Calculation Expression |
---|---|
MTD Sales | Calculates Total Sales for all days in the current month up to the maximum day in the selection.
|
3 Month Average Calculation | 3 Month Average =
|
New Category for Conditional / Logical Operations
Problem | Calculation Expression |
---|---|
IF Condition |
|
SWITCH Statement |
The switch statement can be used when there are many logical tests that need to be performed.
|
AND Function |
The AND function evaluates whether both given conditions are met. If both conditions are indeed met, it yields a TRUE result; if not, it results in FALSE.
|
OR Function |
The OR function evaluates whether either given condition is met. If either condition is met, it yields a TRUE result; if not, it results in FALSE.
|
Opening and Closing Balance
Problem | Calculation Expression |
---|---|
OPENINGBALANCEYEAR() |
Opening Balance can be achieved using any of the three existing built-in functions which will allow you to return the closing balance for Month, Quarter or Year.
|
CLOSINGBALANCEYEAR() |
Closing Balance can be achieved using any of the three existing built-in functions which will allow you to return the closing balance for Month, Quarter or Year.
|
Lookupvalue / Vlookup / Related
Problem | Calculation Expression |
---|---|
Vlookup with no relationship |
The lookupvalue function will return a value from another table when a relationship does not exist in the data model.
|
Vlookup with relationship |
The Related function will return a value from another table leveraging existing relationships in the data model.
|
Year To Date Sales
Problem | Calculation Expression |
---|---|
YTD Sales | Calculates Total Sales for all days in the year up to the maximum day in the selection.
|
YTD Sales (Fiscal Calendar) | This calculation uses an optional third parameter specifying the fiscal year end date.
|
Prior Year Sales
Problem | Calculation Expression |
---|---|
Prior Year Profit |
|
Year over Year Profit | Calculated measure using two previously created calculated measures to determine YoY profit.
|
Last Year YTD Sales |
|
Total Sales for all Countries | This calculation uses calculate to return all countries in the calculation regardless of the filter context.
|
Percent of Total Calculation | This calculation uses two measures previously created to create a percent of total calculation.
|
Moving Totals
Problem | Calculation Expression |
---|---|
Rolling 12 Month Sales | Calculated measure that returns a rolling 12 months total for Profit.
|
7 Day Moving Total |
|
Country Rank | Calculated measure to rank a specific column in a table by a measure. In this measure Country from the geography table is being ranked by the measure [Total Sales].
|
- Download the DAX Cheat Sheet.