The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
We had measures of “Price Variance” which calculated as:
So that we get variance as [IMS Price CY]-[IMS Price LY])*[Quantity Net LY] only if all variables are above 0, otherwise just show 0.
However, for the subtotal it uses the formula to calculate on the last row again, where we just want simple sum of all the price variance showing above.
How to fix this using only one measure with the correct subtotal?
Solved! Go to Solution.
Hi,
I am not sure how your datamodel looks like, but please try something like below.
IMS Price Variance =
SUMX (
VALUES ( 'tablename'[DISTRIBUTION_CHANNEL] ),
CALCULATE (
SWITCH (
TRUE (),
[IMS Price CY] <= 0, 0,
[IMS Price LY] <= 0, 0,
[Quantity Net LY] <= 0, 0,
( [IMS Price CY] - [IMS Price LY] ) * [Quantity Net LY]
)
)
)
Hi,
I am not sure how your datamodel looks like, but please try something like below.
IMS Price Variance =
SUMX (
VALUES ( 'tablename'[DISTRIBUTION_CHANNEL] ),
CALCULATE (
SWITCH (
TRUE (),
[IMS Price CY] <= 0, 0,
[IMS Price LY] <= 0, 0,
[Quantity Net LY] <= 0, 0,
( [IMS Price CY] - [IMS Price LY] ) * [Quantity Net LY]
)
)
)
User | Count |
---|---|
27 | |
12 | |
8 | |
7 | |
5 |
User | Count |
---|---|
31 | |
15 | |
12 | |
7 | |
6 |