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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
brunomitsuo
Frequent Visitor

Cumulative Sum (reference hh:mm:ss) of same time

Hello everyone,

 

In this table, column "Single Value" is a value that i received from a Line Number (in this case mostly 10) in a date and hour. "Cumulative Value" is a calculated column for a cumulative sum.

 

Everything is ok until time is 07:14:12. I got a problem because I received a value from Line Number 5 and 10 at same time, and sum keeps 403,28 twice but it should be "first" 351,40 + 6,98 = 358,38 and "after" 358,38 + 44,90 = 403,28

 

As calculated column dax is:

 

Cumulative Value = CALCULATE(SUM(table[Single Value]);FILTER(table;table[Date Hour]<=EARLIER(table[Date Hour])))

 

 

 

 

How it should be:

 

13/03/2018 07:14:1082150,96351,45
13/03/2018 07:14:126006,98358,385
13/03/2018 07:14:1285344,9403,2810
13/03/2018 07:14:1782125,48428,765
13/03/2018 07:14:199215,92444,6810

 

Many Thanks!!!

1 ACCEPTED SOLUTION
affan
Solution Sage
Solution Sage

Hi @brunomitsuo

 

You can add an other column as below:

 

Hour_Line = 
VALUE(Table1[Date Hour])+(Table1[Line Number]/1000000)

Then use this column to filter in the Cumulative

 

Cumulative Value = CALCULATE(SUM(table1[Single Value]),FILTER(Table1,Table1[Hour_Line]<=EARLIER(table1[Hour_Line])))

Cumulative total based on two columns.png

 

You can download the sample pbix here

 

 

If this helped you, please mark this post as an accepted solution and like to give KUDOS .

 

Regards,

Affan

View solution in original post

2 REPLIES 2
affan
Solution Sage
Solution Sage

Hi @brunomitsuo

 

You can add an other column as below:

 

Hour_Line = 
VALUE(Table1[Date Hour])+(Table1[Line Number]/1000000)

Then use this column to filter in the Cumulative

 

Cumulative Value = CALCULATE(SUM(table1[Single Value]),FILTER(Table1,Table1[Hour_Line]<=EARLIER(table1[Hour_Line])))

Cumulative total based on two columns.png

 

You can download the sample pbix here

 

 

If this helped you, please mark this post as an accepted solution and like to give KUDOS .

 

Regards,

Affan

It worked !!

 

Thanks!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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