Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hello,
Warning! fairly new to DAX filtering in Power BI, but I am trying to do some calcultation on Azure Usage via the Concumption connector, I am trying to follow this guide for Excel https://learn.microsoft.com/en-us/azure/cost-management-billing/reservations/calculate-ea-reservatio...
'Usage details amortized' has more data than a calendar month, so I need a filter to only calculate calendar month, without date filter I have:
Test =
VAR UnitPrice =
SUMX(FILTER('Usage details amortized','Usage details amortized'[ReservationName] <> BLANK()&&'Usage details amortized'[ChargeType]="Usage" ),[UnitPrice])
VAR EffectivePrice1 =
SUMX(FILTER('Usage details amortized','Usage details amortized'[ReservationName] <> BLANK()&&'Usage details amortized'[ChargeType]="Usage" ),[EffectivePrice])
VAR Quantity =
SUM('Usage details amortized'[Quantity])
VAR EffectivePrice =
SUMX(FILTER('Usage details amortized','Usage details amortized'[ChargeType]="UnusedReservation"),[EffectivePrice])
VAR Quantity =
SUM('Usage details amortized'[Quantity])
RETURN
( UnitPrice - EffectivePrice1 - EffectivePrice) * Quantity
For date filter I was looking at using:
DATESBETWEEN('Usage details amortized'[Date],DATE(2022,10,1),DATE(2022,10,31))
If not using date filter is the use of SUMX the best way or should it be CALCULATE ?
Solved! Go to Solution.
Hi @MKPDK ,
I suggest that you can use CALCULATE function, since you can add conditions without adding filter "FILTER( table" such as
SUMX is an iteration function in Power BI that works on a row-by-row calculation per the given expression or equation. This function considers each row at a time and applies the calculation.
When using the CALCULATE function, you can easily branch out to time intelligence calculations. CALCULATE function will change the context of your calculation in Power BI. It’s quite useful when you run some time intelligence calculation where you need to change the context.
You can reference the following document.
The CALCULATE Function In Power BI - DAX Tutorial - Microsoft Power BI Community
SUMX Power BI | How to use SUMX Function in Power BI? (with Example) (wallstreetmojo.com)
Best Regards,
Community Support Team _ xiaosun
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @MKPDK ,
I suggest that you can use CALCULATE function, since you can add conditions without adding filter "FILTER( table" such as
SUMX is an iteration function in Power BI that works on a row-by-row calculation per the given expression or equation. This function considers each row at a time and applies the calculation.
When using the CALCULATE function, you can easily branch out to time intelligence calculations. CALCULATE function will change the context of your calculation in Power BI. It’s quite useful when you run some time intelligence calculation where you need to change the context.
You can reference the following document.
The CALCULATE Function In Power BI - DAX Tutorial - Microsoft Power BI Community
SUMX Power BI | How to use SUMX Function in Power BI? (with Example) (wallstreetmojo.com)
Best Regards,
Community Support Team _ xiaosun
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
94 | |
84 | |
84 | |
73 | |
49 |
User | Count |
---|---|
143 | |
132 | |
110 | |
65 | |
55 |