DAX (Data Analysis Expressions)

Power BI · DAX (Data Analysis Expressions)

Theory

DAX is the formula language of the Power BI model. You use it to write measures (calculations evaluated in the context of a visual), calculated columns (values computed row by row and stored in a table), calculated tables, and row-level security rules. It looks like Excel formulas, with functions such as SUM, AVERAGE and IF, but it works on whole tables and columns rather than cell references: a column is written Table[Column] and a measure [Measure].

The key idea is that a measure has no fixed answer. Total Sales = SUM(Sales[Amount]) returns ₹6,200 on a card, but placed in a table next to Region it returns ₹3,200 for North, ₹2,400 for West and ₹600 for South, because each row of the visual filters the Sales table first. Mastering DAX mostly means understanding this evaluation context and the CALCULATE function that changes it.

Why we use it

DAX turns a model into business answers: totals, ratios, year-to-date, rankings and comparisons that respond instantly to slicers. Without it you are limited to simple implicit sums.

When to use it

Use DAX for anything that must react to report filters or aggregate across rows. Use Power Query for cleaning and reshaping data before it loads. Prefer explicit measures over dragging numeric columns into visuals.

How it works

  1. Write a measure
  2. Visual applies its filters (row, slicers, page)
  3. Sales table is filtered to matching rows
  4. The expression aggregates the remaining rows
  5. More rows or totals in the visual? Yes: Repeat with that row's filters. No: Show the result.
  6. Each cell shows its own answer

Syntax

Measure:  <Measure Name> = <expression>
Column:   Table[Column]      Measure reference: [Measure]
Home → New measure  |  Table tools → New column  |  Modeling → New table
Comments: // single line   /* block */

Example

Total Sales = SUM(Sales[Amount])
Total Qty   = SUM(Sales[Qty])
Orders      = DISTINCTCOUNT(Sales[OrderID])

// Card: [Total Sales] → ₹6,200
// Table visual by Sales[Region]:
//   North ₹3,200 | West ₹2,400 | South ₹600

Key points

Power BI topics

Power BI Introduction

Getting Data

Power Query (Data Transformation)

Data Modeling

DAX (Data Analysis Expressions)

Data Visualization

Dashboards & Reports

Power BI Service

Advanced Features

Projects & Case Studies

Interview & Certification

Advanced DAX & Time Intelligence

T
Tech Town
Log InSign Up Free
Home SQL Python DSA Power BI Snowflake Databricks Spark Gen AI Practice Problems Contest Blog

Power BI Dashboards & DAX

Learn data visualization and interactive dashboards step-by-step. Click any topic in the sidebar to open it right here.

{{ sectionCount }}
Sections
{{ topicCount }}
Topics
Free
Forever
Hands-on practice Practice DAX Online 250 business scenarios on a star schema — write a measure and compare your visual with the expected one. Start practising →
Section {{ sec.num }}

{{ sec.label }}

Power BI  /  {{ current.sectionLabel }}  /  {{ current.name }}

{{ current.name }}

Theory

{{ current.def }}

Why we use it

{{ rich.why }}

When to use it

{{ rich.when }}

Diagram

{{ rich.dg.caption }}

{{ tb.title }}
{{ c.v }}
{{ rich.dg.op }}
➜
{{ rich.dg.output.title }}
{{ c.v }}
{{ nd.label }}
{{ nd.sub }}
{{ nd.label }}
{{ nd.sub }}
{{ rich.dg.left.title }}
{{ it }}
{{ rich.dg.right.title }}
{{ it }}
On screen — where to click

{{ rich.ui.title }}

{{ u.text }}
  1. {{ st.n }}{{ st.text }}
{{ rich.ui.title }}
{{ u.text }}
Flowchart — how it works
{{ nd.text }}
{{ nd.text }}
◇ {{ nd.text }}
Yes → {{ nd.yes }}
No → {{ nd.no }}
Syntax / Where to find it
{{ current.syntax }}
Example
{{ current.example }}
What You'll Learn — click to check off
  • {{ pt.mark }} {{ pt.text }}

Share this topic