DAX Functions in Power BI
Carl Rosseel
Curriculum Manager at DataCamp
Calculated Columns:
COST = Orders[Sales] - Orders[Profit]
Order_ID | Sales | Profit | Cost |
---|---|---|---|
3151 | $77.88 | $3.89 | $73.99 |
3152 | $6.63 | $1.79 | $4.84 |
3153 | $22.72 | $10.22 | $12.50 |
3154 | $45.36 | $21.77 | $23.59 |
Calculated Columns:
COST = Orders[Sales] - Orders[Profit]
Order_ID | Sales | Profit | Cost |
---|---|---|---|
3151 | $77.88 | $3.89 | $73.99 |
3152 | $6.63 | $1.79 | $4.84 |
3153 | $22.72 | $10.22 | $12.50 |
3154 | $45.36 | $21.77 | $23.59 |
Measures:
Total Sales = SUM(Orders[Sales])
Region | Total Sales |
---|---|
Central | $501,239.89 |
East | $678,781.24 |
West | $391,721.91 |
South | $725.457.82 |
Total | $2,297,200.86 |
There are three types of context: row, query, and filter context
COST = Orders[Sales] - Orders[Profit]
There are three types of context: row, query, and filter context
COST = Orders[Sales] - Orders[Profit]
Order_ID | Sales | Pofit | Cost |
---|---|---|---|
3151 | $77.88 | $3.89 | $73.99 |
3152 | $6.63 | $1.79 | $4.84 |
3153 | $22.72 | $10.22 | $12.50 |
3154 | 45.36 | $21.77 | $23.59 |
There are three types of context: row, query, and filter context
Region | Total Sales |
---|---|
Central | $501,239 |
East | $678,781 |
West | $391,721 |
South | $725.457 |
State | Total Sales |
---|---|
Alabama | $13,724 |
Arizona | $38,710 |
Arkansas | $7,669 |
California | $381,306 |
There are three types of context: row, query, and filter context
There are three types of context: row, query, and filter context.
Total Costs East = CALCULATE([Total Costs], Orders[Region] = 'East')
Region | Total costs | Total costs East |
---|---|---|
Central | $617,039 | |
East | $587,258 | $587,258 |
West | $461,534 | |
South | $344,972 | |
Total | $2,010,804 | $587,258 |
DAX Functions in Power BI