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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
MichaelG_NAC
Frequent Visitor

Comparing value between years based on another column

Hello 

I am looking to compare Values between diffrent years 

YearUniqueValue

1

A5
1B10
2A15
3C16
2B20


so at the end im looking to have a subtraction from the highest year - the lowest year based on the Unique 

 

UniqueValue
A10 (15-5)
B10 (20-10)
C16

 

Would this be possible or would another method be needed

1 ACCEPTED SOLUTION
DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

try this:

 

Measure 4 = var _max = CALCULATE(max('Table (3)'[Value]),ALLEXCEPT('Table (3)','Table (3)'[Unique]))

var _min = CALCULATE(min('Table (3)'[Value]),ALLEXCEPT('Table (3)','Table (3)'[Unique]))

return

 if(COUNT('Table (3)'[Unique])=1,_max,_max - _min)
 
DOLEARY85_0-1681910578166.png

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

View solution in original post

1 REPLY 1
DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

try this:

 

Measure 4 = var _max = CALCULATE(max('Table (3)'[Value]),ALLEXCEPT('Table (3)','Table (3)'[Unique]))

var _min = CALCULATE(min('Table (3)'[Value]),ALLEXCEPT('Table (3)','Table (3)'[Unique]))

return

 if(COUNT('Table (3)'[Unique])=1,_max,_max - _min)
 
DOLEARY85_0-1681910578166.png

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.