#1 Data Analytics Program in India
₹2,499₹1,499Enroll Now
Module 9
6 min read

Advanced DAX Patterns

Learn advanced DAX patterns for complex analysis

What You'll Learn

  • Running totals
  • Ranking products
  • Percentage contribution
  • Moving averages

Running Total (Cumulative)

Shows cumulative sum over time.

Running Total

Running Total =
CALCULATE(
    [Total Sales],
    FILTER(
        ALL(Calendar[Date]),
        Calendar[Date] <= MAX(Calendar[Date])
    )
)
MonthSalesRunning Total
Jan$100K$100K
Feb$120K$220K
Mar$80K$300K

Ranking

Rank products by sales (1 = best).

Ranking

Rank = RANKX(ALL(Products), [Total Sales], , DESC)
ProductSalesRank
Product A$50K1
Product B$40K2
Product C$30K3

Percentage Contribution

What % does each product contribute to total?

% Contribution =
DIVIDE(
    [Total Sales],
    CALCULATE([Total Sales], ALL(Products))
)
ProductSales% Contribution
Product A$50K42%
Product B$40K33%
Product C$30K25%

Moving Average

Smooth out fluctuations with 3-month average.

Moving Average

3 Month Avg =
AVERAGEX(
    DATESINPERIOD(Calendar[Date], LASTDATE(Calendar[Date]), -3, MONTH),
    [Total Sales]
)

Quick Reference

PatternUse For
Running TotalCumulative progress
RANKXTop/bottom performers
% ContributionPart vs whole
Moving AverageTrend smoothing

Performance Tips

DoDon't
Use variables (VAR)Repeat same calculation
Use simple filtersComplex FILTER when not needed
Test with small dataJump to full dataset

Try This

  1. Create Running Total measure
  2. Create Rank measure
  3. Create % Contribution measure
  4. Add all to a table visual
  5. See the patterns in action!

Tip: These patterns take practice. Start with one, master it, then move to the next!

SkillsetMaster - AI, Web Development & Data Analytics Courses