Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance 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 |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
12 | |
11 | |
8 | |
6 |