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.
Hi everyone,
I'd like to calculate differences for PRICE when using multiple slicers. I would like to compare PRICE within the same PRODUCT/STATE/YEAR/SIZE. (In my dataset, I have one unique row for every combination of PRODUCT/STATE/YEAR/SIZE).
In the example below, I would want to calculate the difference in price for the blue rows, and do the same thing for the green rows.
(e.g. the difference for blue rows would be 5-3=2. The difference for green rows would be 6-5=1.)
I have 4 slicers for PRODUCT, STATE, YEAR, SIZE.
PRODUCT | STATE | YEAR | SIZE | PRICE |
Apple | CA | 2001 | S | 3 |
Apple | GA | 2002 | M | 4 |
Apple | CA | 2003 | S | 5 |
Banana | FI | 2002 | M | 5 |
Banana | FI | 2003 | M | 6 |
Banana | FI | 2004 | M | 7 |
Cherry | CA | 2002 | L | 1 |
Cherry | FI | 2004 | M | 5 |
Thank you so much in advance for your help!!!
Solved! Go to Solution.
Hi @roundbunny ,
The Table data is shown below:
Please follow these steps:
1. Use the following DAX expression to create a measure named ‘Price difference’
Price difference =
VAR _a = MIN('Table'[PRICE])
VAR _b = MAX('Table'[PRICE])
RETURN _b - _a
2. Fianl output
Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @roundbunny ,
The Table data is shown below:
Please follow these steps:
1. Use the following DAX expression to create a measure named ‘Price difference’
Price difference =
VAR _a = MIN('Table'[PRICE])
VAR _b = MAX('Table'[PRICE])
RETURN _b - _a
2. Fianl output
Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
thanks so much!
User | Count |
---|---|
73 | |
72 | |
39 | |
25 | |
23 |
User | Count |
---|---|
96 | |
93 | |
51 | |
43 | |
42 |