3 Tips to use SUMX() in Power BI — Ways to Master DAX
There are 3 common ways to use SUMX().
- Calculate distincount.
By using SUMX() to calculate distinct count, would get better performance.
- Calculate Sales Amount.
By using SUMX() would calculate value row by row, then sum up result at end. This is also the classic way to use SUMX().
[2.銷額加總#] = SUMX(_retail_table, [sales_price] * [qty])
- Condition Calculate with VAR.
This would be a advanced tip to use.
By calculate condition criteria row by row, then sum up result at end.
VAR _sales_price = [sales_price]
, _sales_price >2, [sales_price] * [qty]
Learn more from my LinkedIn if you also interest in Power BI and DAX.