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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register 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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.