Ravindra BagaleCourses & study guides मराठी Track your progress

13. DAX: Data Analysis Expressions

13.1 What is DAX?

In short: DAX (Data Analysis Expressions) is the formula language of Power BI, Analysis Services and Power Pivot in Excel.

DAX (Data Analysis Expressions) is the formula language of Power BI, Analysis Services and Power Pivot in Excel. It looks similar to Excel formulas, but there is one big difference: Excel formulas work on cells, DAX works on tables and columns. You never refer to "cell B2"; you refer to Orders[Amount] and let the context decide which rows are included.

You write DAX in three places:

Object Created with Evaluated Stored
Calculated column Table tools › New column Row by row, at data refresh Stored in the model (uses memory)
Measure Home › New measure At query time, in the current filter context Not stored – only the formula
Calculated table Modeling › New table At data refresh Stored in the model

About this data: This table uses columns: Object, Created with, Evaluated, Stored. Values shown are the lesson examples already on this page (not a new dataset).

Ravindra Bagale's Tip

Friends, many students start DAX by writing long formulas copied from the internet. Start with simple base measures (Total Sales, Total Orders) and build new measures on top of them. Understanding filter context matters much more than memorising function names. Remember this rule.

Loading DAX practice tasks...

  1. Total units sold (Easy): Create a measure Total Qty that adds up the Qty column of the Orders table.
  2. Count order lines (Easy): Create a measure Order Lines that counts the rows of the Orders table.
  3. Biggest quantity in one line (Easy): Create a measure Max Qty that returns the largest Qty in Orders.
  4. Total discount given (Easy): Create a measure Total Discount that adds the Discount column of Orders.
  5. Average unit price (Easy): Create a measure Avg Unit Price that gives the average of Orders[UnitPrice].
  6. Number of different customers (Medium): Create a measure Customers that counts how many different CustomerID values appear in Orders.
  7. Total sales value (Medium): Create a measure Sales Value that multiplies Qty by UnitPrice on each Orders row and adds the results.
  8. Fastest delivery (Medium): Create a measure Fastest Delivery that returns the smallest DeliveryMins. Blank cells (cancelled orders) are ignored automatically.
  9. Average order lines per customer (Hard): Create a measure Lines per Customer = order lines divided by different customers. Use the safe divide function.
  10. Gross profit (Hard): Create a measure Gross Profit = SUM over Orders of Qty × (UnitPrice − the product's CostPrice). CostPrice lives in Product.

Ravi Sir's Cards for this lesson

मराठी cards