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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Super User
Super User

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
Super User
Super User

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.