5 Important DAX Functions Everyone Should Know in Power BI

Top 5 DAX Functions Every Analyst Should Master

Power BI’s strength lies in its ability to transform raw data into actionable insights. At the heart of this capability is DAX – a powerful formula language that enables dynamic calculations and KPIs. Whether you’re a beginner or an experienced analyst, mastering these five DAX functions will elevate your dashboards and reporting.

1️⃣ Year-to-Date (YTD) Sales

Purpose: Track revenue or metrics cumulatively from the start of the year. Accurate YTD numbers across all slicers (Year, Month, Region)

DAX Measure:

YTD Sales =
TOTALYTD(
SUM(Sales[SalesAmount]),
'Date'[Date]
)

Key Points:

  • TOTALYTD() applies YTD logic automatically.
  • Requires a properly marked Date table.

Use Case: Finance teams monitoring YTD revenue vs targets.

2️⃣ Year-over-Year (YoY) Growth %

Purpose: Compare current year performance against the previous year. How do you calculate Year-over-Year growth? Leadership comparing current year vs last year performance

DAX Measures:

Sales LY =
CALCULATE(
[Total Sales],
SAMEPERIODLASTYEAR('Date'[Date])
)
YoY Growth % =
DIVIDE(
[Total Sales] - [Sales LY],
[Sales LY]
)

Key Points:

  • SAMEPERIODLASTYEAR() shifts the date context.
  • DIVIDE() prevents divide-by-zero errors.

Use Case: Leadership dashboards showing growth trends.

3️⃣ Running Total (Cumulative Sales)

Purpose: Display cumulative values over time, such as monthly sales trends. Sales head wants cumulative monthly trend. Show cumulative sales over time

DAX Measure:

Running Total Sales =
CALCULATE(
[Total Sales],
FILTER(
ALL('Date'),
'Date'[Date] <= MAX('Date'[Date])
)
)

Key Points:

  • ALL('Date') removes filters to calculate across the entire timeline.
  • MAX('Date'[Date]) ensures cumulative logic up to the current row.

Use Case: Sales trend analysis with cumulative charts.

4️⃣ % Contribution to Total

Purpose: Show how each category contributes to overall sales. Marketing wants category share of total sales

DAX Measure:

Sales Contribution % =
DIVIDE(
[Total Sales],
CALCULATE([Total Sales], ALL(Product[Category]))
)

Key Points:

  • Numerator → Current category sales.
  • Denominator → Total sales ignoring category filter.
  • ALL() resets the category context.

Use Case: Marketing teams identifying top-performing categories.

5️⃣ Dynamic KPI Based on Slicer

Purpose: Allow users to switch between different KPIs (Sales, Profit, Margin) dynamically. One visual supports multiple KPI

How do you create a dynamic KPI using slicer selection?

DAX Measure:

Selected KPI Value =
SWITCH(
SELECTEDVALUE(KPI[KPI_Name]),
"Sales", [Total Sales],
"Profit", [Total Profit],
"Margin", [Profit Margin]
)

Key Points:

  • SELECTEDVALUE() captures slicer choice.
  • SWITCH() is cleaner and faster than multiple IF conditions.

Use Case: Dashboards where users toggle between KPIs.

🎯 Final Thoughts

These five DAX functions – TOTALYTD, SAMEPERIODLASTYEAR, CALCULATE with FILTER, DIVIDE with ALL, and SWITCH with SELECTEDVALUE are foundational building blocks for Power BI reporting. They help you create dynamic KPIs, trend analyses, and category breakdowns that drive real business decisions.

Mastering these will not only make your dashboards more insightful but also demonstrate your ability to handle real-world analytics challenges.


Discover more from LR Virtual Classroom

Subscribe to get the latest posts sent to your email.

Published by Lashmi Bai Ravindrapandian

V Shaped Functional PMO Professional | Helping Org to execute their Programs | Learning Evangelist | Strategic & Digital Mindset | Agilist | Manager at Mind & Leader at Heart