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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Cumulative column from time with categorical filter

Hi, I would like to calculate a cumulative column of [Duration] as a function of increasing [Time]. I would also like to perform the calculation filtered by [Name]. The bolded column, [Cumulative Duration] below is my goal. 

 

Thanks in advance, I really appreciate the help! 

 

NameDurationTimeCumulative Duration
Brett0.24/2/2020 15:300.2
Brett0.34/2/2020 15:320.5
Brett0.24/2/2020 15:350.7
John0.34/2/2020 15:290.3
John0.44/2/2020 15:320.7
John0.24/2/2020 15:350.9
John0.14/2/2020 15:511
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Jkilb ,

Duración acumulativa: calculate(sum([Duration]), filter(Table,[Name] á earlier([Name]) && [Time] <earlier([Time])))

Or
Cumulative duration: sumx( filter(Table,[Name] á earlier([Name]) && [Time] <earlier([Time])),[Duration])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @Anonymous  

Create a calculated column:

Column = CALCULATE(SUM('Table'[Duration]),ALLEXCEPT('Table','Table'[Name]),'Table'[Time] <= EARLIER('Table'[Time]))

v-jingzhang_0-1600306141039.png

 

Or create a measure:

Measure = CALCULATE(SUM([Duration]), FILTER(ALLEXCEPT('Table','Table'[Name]),'Table'[Time] <=MAX('Table'[Time])))

v-jingzhang_1-1600306141042.png

Best Regards,

Community Support Team _ Jing Zhang

If this post helps, please consider Accept it as the solution to help other members find it.

amitchandak
Super User
Super User

@Jkilb ,

Duración acumulativa: calculate(sum([Duration]), filter(Table,[Name] á earlier([Name]) && [Time] <earlier([Time])))

Or
Cumulative duration: sumx( filter(Table,[Name] á earlier([Name]) && [Time] <earlier([Time])),[Duration])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Greg_Deckler
Community Champion
Community Champion

@Anonymous - Should be something like:

Column = SUMX(FILTER('Table',[Time]<=EARLIER([Time])&&[Name]=EARLIER([Name])),[Duration])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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