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
Anonymous
Not applicable

Subtract two columns based on a third id Column

Hello, 

 

How would you reccomend finding the difference of 1st & 2nd event age? 

 

Each ID has a 1st event age, and if event 1 fails, another row with the same ID has a 2nd event age. 

 

senad_1-1659194503235.png

 

 

 

I have been trying to do this with a calculated column, but feel a measure might be more suitable? What do you think?

 

1 ACCEPTED SOLUTION
ribisht17
Super User
Super User

@Anonymous 

 

Are you looking for something like this ?

ribisht17_0-1659200317235.png

 

Step 1

Max Event Age = CALCULATE(MAX(ColumnDiff[1 Event Age]),ALLEXCEPT(ColumnDiff,ColumnDiff[ID]))
 
Step 2
Min 2Event Age = CALCULATE(MIN(ColumnDiff[2 Event Age]),ALLEXCEPT(ColumnDiff,ColumnDiff[ID]))
 
Step 3
Diff = ColumnDiff[Max 1Event Age]-ColumnDiff[Min 2Event Age]
 

You did not mention about the output for which thre is no failure ?

 

Regards,

Ritesh

View solution in original post

2 REPLIES 2
ribisht17
Super User
Super User

@Anonymous 

 

Are you looking for something like this ?

ribisht17_0-1659200317235.png

 

Step 1

Max Event Age = CALCULATE(MAX(ColumnDiff[1 Event Age]),ALLEXCEPT(ColumnDiff,ColumnDiff[ID]))
 
Step 2
Min 2Event Age = CALCULATE(MIN(ColumnDiff[2 Event Age]),ALLEXCEPT(ColumnDiff,ColumnDiff[ID]))
 
Step 3
Diff = ColumnDiff[Max 1Event Age]-ColumnDiff[Min 2Event Age]
 

You did not mention about the output for which thre is no failure ?

 

Regards,

Ritesh

Anonymous
Not applicable

Ah yes! Thank you, very clean way to do it. 

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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.