Getting started¶
DAX is an expression language evaluated by a tabular-model engine. It is not Python, SQL, or the Power Query M language. DAX normally calculates or queries data already loaded/available in a semantic model; Power Query prepares data.
Choose a tool¶
| Tool | Use in this guide | Important limitation |
|---|---|---|
| Power BI Desktop on Windows | Import the CSVs, create a model, use DAX query view and reports | Desktop is not a native macOS app |
| DAX Studio | Connect to an open Power BI/Analysis Services model; query and profile | Installing the editor does not install a standalone DAX engine |
| Excel Power Pivot | Practice supported model measures and PivotTables | Availability and functions depend on your Excel edition |
| Power BI service / Fabric | Query an existing eligible semantic model | Requires appropriate access/permissions and product availability |
Install through the official Power BI Desktop instructions. Use the official DAX query view guide or DAX Studio documentation. There is no requirement to publish a workspace or buy capacity for local practice.
First query: no retail import needed¶
Open a supported DAX query window connected to an engine. This example uses an in-query table; it does not depend on the retail model or install anything.
EVALUATE
VAR Items =
DATATABLE (
"Quantity", INTEGER,
"UnitPrice", CURRENCY,
{
{ 1, 1000 },
{ 5, 20 },
{ 3, 50 }
}
)
RETURN
ROW (
"Revenue", SUMX ( Items, [Quantity] * [UnitPrice] ),
"Safe Division", DIVIDE ( 10, 0 ),
"Explicit Zero", DIVIDE ( 10, 0, 0 )
)
Expected one row:
| Revenue | Safe Division | Explicit Zero |
|---|---|---|
| 1250 | BLANK | 0 |
EVALUATE expects a table. ROW turns scalar results into a one-row table.
SUMX visits each Items row and sums quantity times price.
DIVIDE returns BLANK on a zero denominator unless you specify an alternate.
Different clients display BLANK as an empty cell or null-like representation.
Exercise: change the third quantity from 3 to 4. Predict Revenue 1300, run it, and restore the original example. The query does not mutate model data.
Where should code be pasted?¶
- A measure source such as
Revenue = ...: choose New measure. - A calculated-column source: choose New column in the named table.
- A calculated-table source: choose New table.
- A query beginning
EVALUATEorDEFINE: use DAX query view/DAX Studio. - An RLS rule: use Manage roles on the stated table.
Queries are not measure definitions pasted into the formula bar. Query-scoped
DEFINE MEASURE overrides last only for that query and do not persist model
changes unless you explicitly use a supported update-model action.
Continue with model setup. Sources: DAX queries and DIVIDE.