← Blog
COMPLETE TUTORIAL — INDIA 2026

Power BI DAX Tutorial 2026
35 Formulas with Real Business Examples

DAX is what separates a Power BI report builder from a Power BI analyst. This tutorial covers every DAX pattern you need — from basic SUM to time intelligence (Indian FY April–March) to RANKX — with real examples and interview notes from the Indian job market.

Aggregation & Basic MeasuresCALCULATEFILTER & Table FunctionsTime IntelligenceRanking, Top N & Advanced Patterns

Before You Start: Understand Filter Context

The single concept that makes DAX hard for beginners is filter context — the set of active filters applied when a measure is evaluated. Every visual, slicer, and row/column header in your report creates a filter context, and DAX measures respond to it automatically.

CALCULATE() is the only DAX function that modifies filter context — everything advanced in DAX is essentially a creative use of CALCULATE. Once filter context clicks, the rest of DAX becomes logical.

Aggregation & Basic Measures

SUM
Total Sales = SUM(Sales[Amount])

When to use: Adds all values in a column. Responds to all active filters in the report.

Note: Avoid using SUM in a calculated column — use it only in measures. In a column, use row-level arithmetic instead.

SUMX
Revenue = SUMX(Sales, Sales[Qty] * Sales[UnitPrice])

When to use: Iterates row by row and sums the result of an expression. Use when you need to multiply before summing — do NOT just multiply summary measures.

Note: SUMX is an iterator — it is more flexible than SUM but slightly slower on very large tables.

AVERAGEX
Avg Order Value = AVERAGEX(Orders, Orders[Revenue])

When to use: Calculates average of an expression row by row. Useful when you want the average of computed values rather than raw column averages.

COUNTROWS
Order Count = COUNTROWS(Orders)

When to use: Counts the number of rows in a table (or filtered table). Preferred over COUNT for counting records.

Note: Faster than COUNTA or COUNT because it does not scan column values.

DISTINCTCOUNT
Unique Customers = DISTINCTCOUNT(Sales[CustomerID])

When to use: Counts distinct values in a column — essential for customer count, unique product count, or unique city count.

MIN / MAX
Latest Sale = MAX(Sales[SaleDate])

When to use: Returns minimum or maximum value. Commonly used on dates to find the first or last transaction date.

CALCULATE — The Most Important DAX Function

CALCULATE (basic)
Sales Delhi = CALCULATE(SUM(Sales[Amount]), Sales[City] = "Delhi")

When to use: Evaluates the first argument (the expression) in a modified filter context. Here, it overrides the City filter to always show Delhi sales regardless of slicer selection.

Note: CALCULATE is the only function in DAX that can modify filter context. Everything that uses dynamic filtering ultimately relies on CALCULATE.

CALCULATE with multiple filters
Q1 Online Sales = CALCULATE(
  SUM(Sales[Amount]),
  Sales[Quarter] = "Q1",
  Sales[Channel] = "Online"
)

When to use: Multiple filter arguments are combined with AND logic — all conditions must be true. Use FILTER() inside CALCULATE when you need OR logic.

CALCULATE with ALL (remove filter)
% of Total = 
  DIVIDE(
    SUM(Sales[Amount]),
    CALCULATE(SUM(Sales[Amount]), ALL(Sales))
  )

When to use: ALL() removes all filters from the specified table or column, letting you calculate a grand total for use in percentage-of-total calculations.

Note: This is one of the most commonly tested DAX patterns in Indian Power BI interviews.

CALCULATE with ALLEXCEPT
Sales % by City = 
  DIVIDE(
    SUM(Sales[Amount]),
    CALCULATE(SUM(Sales[Amount]), ALLEXCEPT(Sales, Sales[City]))
  )

When to use: ALLEXCEPT removes all filters except the specified columns — useful for "% within category" calculations where you want to keep some slicers but clear others.

FILTER & Table Functions

FILTER
High Value Sales = 
  CALCULATE(
    SUM(Sales[Amount]),
    FILTER(Sales, Sales[Amount] > 50000)
  )

When to use: Returns a table with rows matching a condition. Used inside CALCULATE when the filter condition is complex or involves a measure (not just a column value).

Note: FILTER is an iterator — avoid using it on very large tables without a pre-filter. Use column-based filter arguments in CALCULATE when possible for performance.

RELATED
Product Category = RELATED(Products[Category])

When to use: Fetches a value from a related table (following the many-to-one relationship). Used in calculated columns to bring in dimension attributes from a lookup table.

Note: Only works in calculated columns, not measures. In measures, the relationship is traversed automatically by the filter context.

RELATEDTABLE
Orders Per Customer = COUNTROWS(RELATEDTABLE(Orders))

When to use: Returns the related table from the one side of a one-to-many relationship. Used in calculated columns on the "one" side (e.g., Customers table) to aggregate child records.

SELECTEDVALUE
Selected City = SELECTEDVALUE(Sales[City], "All Cities")

When to use: Returns the single selected value in a filter, or the default if multiple values are selected. Perfect for dynamic titles and conditional formatting based on slicer selection.

VALUES
City List = VALUES(Sales[City])

When to use: Returns a one-column table of distinct values in the current filter context. Used inside CALCULATE or iterators — not for direct display.

Time Intelligence — MTD, QTD, YTD, and YoY

TOTALYTD
Sales YTD = TOTALYTD(SUM(Sales[Amount]), Dates[Date])

When to use: Calculates year-to-date cumulative total. Requires a properly marked date table in your data model.

Note: If your fiscal year does not start in January, add the optional third argument: TOTALYTD(..., ..., "31-03") for Indian financial year ending March 31.

TOTALMTD / TOTALQTD
Sales MTD = TOTALMTD(SUM(Sales[Amount]), Dates[Date])
Sales QTD = TOTALQTD(SUM(Sales[Amount]), Dates[Date])

When to use: Month-to-date and quarter-to-date cumulative totals. Same pattern as TOTALYTD.

SAMEPERIODLASTYEAR
Sales LY = CALCULATE(
  SUM(Sales[Amount]),
  SAMEPERIODLASTYEAR(Dates[Date])
)

When to use: Returns the same period in the prior year — used for year-over-year comparison dashboards.

YoY Growth %
YoY % = 
  DIVIDE(
    SUM(Sales[Amount]) - [Sales LY],
    [Sales LY]
  )

When to use: Combines current year measure and SAMEPERIODLASTYEAR measure to calculate growth rate. Wrap in FORMAT() for display as a percentage.

Note: Always use DIVIDE() instead of "/" to safely handle division-by-zero (returns BLANK instead of an error).

DATEADD
Sales Prev Month = CALCULATE(
  SUM(Sales[Amount]),
  DATEADD(Dates[Date], -1, MONTH)
)

When to use: Shifts a date period by a specified interval. More flexible than SAMEPERIODLASTYEAR — can compare any period offset (months, quarters, years).

DATESYTD (Indian FY)
FY Sales YTD = CALCULATE(
  SUM(Sales[Amount]),
  DATESYTD(Dates[Date], "31-03")
)

When to use: Defines the YTD range explicitly — essential for Indian financial year reporting (April–March) where TOTALYTD defaults to calendar year.

Note: This is one of the most asked DAX interview questions for finance/BFSI roles in India.

Ranking, Top N & Advanced Patterns

RANKX
Product Rank = RANKX(
  ALL(Products[ProductName]),
  [Total Sales],
  ,
  DESC,
  Dense
)

When to use: Ranks each row within a specified table based on a measure. ALL() is required to rank across all products regardless of current filter.

Note: RANKX is almost always tested in Power BI interviews in India. Know the parameters: table, expression, value, order (ASC/DESC), ties (Skip or Dense).

TOPN
Top 5 Customers = 
  TOPN(5, VALUES(Sales[CustomerName]), [Total Sales], DESC)

When to use: Returns a table of the top N rows by a measure. Often used inside CALCULATE or SUMX to aggregate only the top performers.

SWITCH
Sales Band = 
  SWITCH(
    TRUE(),
    [Total Sales] >= 1000000, "Platinum",
    [Total Sales] >= 500000,  "Gold",
    [Total Sales] >= 100000,  "Silver",
    "Bronze"
  )

When to use: Evaluates conditions and returns a result — works like nested IF but much cleaner. SWITCH(TRUE(), ...) is the standard pattern for range-based categorisation.

VAR ... RETURN
Growth Label = 
  VAR CurrentSales = SUM(Sales[Amount])
  VAR LastYearSales = [Sales LY]
  VAR Growth = DIVIDE(CurrentSales - LastYearSales, LastYearSales)
  RETURN
    IF(Growth > 0, "▲ " & FORMAT(Growth, "0%"), "▼ " & FORMAT(Growth, "0%"))

When to use: Variables store intermediate results — they improve readability and performance by evaluating sub-expressions once instead of multiple times. Use VAR...RETURN in any complex measure.

Note: DAX variables are evaluated in the filter context where they are defined, not where they are used. This matters inside iterators.

DIVIDE
Margin % = DIVIDE([Gross Profit], [Revenue], 0)

When to use: Safe division — returns the third argument (alternate result) instead of an error when the denominator is zero or BLANK. Always use DIVIDE() over "/" in measures.

IF with ISBLANK
Safe Revenue = IF(ISBLANK([Total Sales]), 0, [Total Sales])

When to use: Handles BLANK results — converts them to zero for display purposes. Useful for period comparisons where some months may have no data.

DAX Interview Cheat Sheet — What Indian Companies Actually Ask

CALCULATE with ALL
"Calculate % of total sales for each product" — requires CALCULATE + ALL to get grand total denominator.
Almost
RANKX
"Show each city ranked by revenue" — requires RANKX with ALL() and Dense/Skip tie-breaking.
Very
YoY % with SAMEPERIODLASTYEAR
"Calculate year-over-year growth" — requires a date table, SAMEPERIODLASTYEAR, and DIVIDE.
Commonly
Indian FY time intelligence (April–March)
"Calculate YTD for Indian financial year" — DATESYTD or TOTALYTD with "31-03" end date argument.
Asked
Measure vs Calculated Column
Know when to use each: measures for aggregations, calculated columns for row-level attributes stored in the model.
Conceptual
SWITCH(TRUE())
"Categorise customers into bands based on order value" — SWITCH(TRUE(), [measure] >= value, "label", ...) pattern.
Moderately
VAR...RETURN
"Rewrite this complex measure cleanly" — VAR...RETURN demonstrates code quality and understanding of evaluation order.
Asked

Frequently Asked Questions

What is DAX in Power BI?

DAX (Data Analysis Expressions) is the formula language used in Power BI to create custom calculations — measures and calculated columns. It is designed for relational data models and excels at aggregations across filters, time comparisons (year-over-year, month-to-date), and ranked calculations. DAX is not like Excel formulas — it operates on tables and columns rather than individual cells, and understanding filter context is the key to mastering it.

What is the difference between a Measure and a Calculated Column in DAX?

A Measure is calculated dynamically at query time based on the current filter context in your report — every time a user slices data, the measure recalculates. A Calculated Column is computed row-by-row when data is loaded and stored physically in the data model, consuming memory. Use measures for aggregations (SUM, AVERAGE, COUNT) that respond to filters. Use calculated columns for row-level logic — categorising rows, creating flags, or combining text — that does not need to vary by filter.

How long does it take to learn DAX in Power BI?

With structured learning and daily practice on real datasets, most learners grasp DAX fundamentals (SUM, CALCULATE, FILTER, basic time intelligence) in 4–6 weeks. Advanced DAX — RANKX, TOPN, complex time intelligence with custom calendars, iterator patterns — takes 2–3 months of hands-on project work. Live, instructor-led training with immediate feedback accelerates this significantly compared to self-paced video courses where learners often get stuck on filter context errors with no one to ask.

Is DAX knowledge required for a Power BI analyst job in India?

Yes — DAX is essential for Power BI analyst and BI developer roles in India. Interviewers at IT companies, MNCs, and mid-size firms consistently test CALCULATE, time intelligence (MTD/YTD), and RANKX in Power BI interviews. Candidates who can only use basic aggregations without DAX are placed in junior roles with limited growth. DAX skill — particularly CALCULATE and time intelligence — is the single biggest differentiator between entry-level and mid-level Power BI salaries in India.

Related guides
Power BI Interview Q&ABest Analytics Tools IndiaData Analyst Skills ChecklistCertification Guide India

EVIKA ACADEMY · NOIDA SECTOR 51 · LIVE POWER BI TRAINING

Learn DAX with live instruction and real data projects

Practice on live datasets. Build dashboards that go into your portfolio. Get interview-ready for Power BI roles. Free demo first.

Book Free Demo →