Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
roundbunny
Frequent Visitor

calculating differences between rows when using 4 slicers

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 STATEYEARSIZEPRICE
AppleCA2001S3
AppleGA2002M4
AppleCA2003S5
BananaFI2002M5
BananaFI2003M6
BananaFI2004M7
CherryCA2002L1
CherryFI2004M5

 

Thank you so much in advance for your help!!! 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @roundbunny ,

The Table data is shown below:

vzhouwenmsft_0-1710397618230.png

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

vzhouwenmsft_1-1710397702809.png

vzhouwenmsft_2-1710397710963.png

vzhouwenmsft_3-1710397720900.png

 

vzhouwenmsft_4-1710397728123.png

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.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @roundbunny ,

The Table data is shown below:

vzhouwenmsft_0-1710397618230.png

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

vzhouwenmsft_1-1710397702809.png

vzhouwenmsft_2-1710397710963.png

vzhouwenmsft_3-1710397720900.png

 

vzhouwenmsft_4-1710397728123.png

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! 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.