Back to Topics

DAX Functions

Advanced
18 min

What is DAX Functions?

DAX (Data Analysis Expressions) is a formula language for Power BI that allows you to create custom calculations and measures.

Key Components:

  • Creates calculated columns and measures
  • Performs row and filter context calculations
  • Enables time intelligence
  • Similar to Excel formulas

Why it matters

Custom Metrics

Create year-over-year comparisons

Running Totals

Calculate cumulative values

Dynamic KPIs

Build interactive measures

Filter Control

Apply conditional logic

Key Concepts

CALCULATE

Changes filter context

Example: CALCULATE(SUM(Sales), YEAR = 2024)...

SUMX

Iterator over table rows

Example: SUMX(Sales, Quantity * Price)...

FILTER

Returns filtered table

Example: FILTER(Products, Price > 100)...

ALL

Removes filters

Example: CALCULATE(SUM(Sales), ALL(Products))...

How to use

1

Go to Modeling tab

Click New Measure

2

Name measure

Descriptive name

3

Write formula

Start with SUM or CALCULATE

4

Use CALCULATE

For filter context changes

5

Add conditions

Use FILTER when needed

6

Format measure

Set number format

Example

Goal: Sales for current year
Total Sales CY = CALCULATE(SUM(Sales[Amount]), YEAR(Sales[Date]) = YEAR(TODAY()))
Result: Shows only current year sales

Pro Tips

  • Use variables: VAR for complex logic
  • Understand context: Row vs filter context
  • Test measures: Verify in table visual

Practice

Create a measure that shows sales growth compared to previous month