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

Cumulative sum without date or rank

Hello,
I have a dataframe like below;

https://ibb.co/ctLf25g

 

I want to calculate running total for 'Duration' column(ascending version)
Do I have to rank them first or is there any other way?

All ranking examples work for columns but I need to rank Duration column as measure if needed.

 

Thanks in advance,

 
 
 
9 REPLIES 9
az38
Community Champion
Community Champion

Hi @Anonymous 

try a calculated column

Column = calculate(sum(Table1[Duration]);filter(all(Table1);Table1[Duration]<=earlier(Table1[Duration])))

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Hello,

Thank you for your answer but I need measure because I have several slicers so every running sum calculation needs to be remade for every selection.

az38
Community Champion
Community Champion

@Anonymous 

no problem

this measure should work 

Measure = calculate(sum(Table1[Duration]);filter(all(Table1);'Table1'[Duration]<=SELECTEDVALUE('Table1'[Duration])))

do not hesitate to give a kudo to useful posts and mark solutions as solution

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

@az38 

Thanks for answer but this formula effects and consider all table.
I want to calculate it dynamically.
In below image it works fine.
https://ibb.co/qW9X0SX
But when I slice Ma_2 it doesn't re-calculate the selection
https://ibb.co/2PRS38m

Hi @Anonymous 

 

Try this Measure

Measure = 
VAR __maxDuration = MAX( 'Table'[Duration] )
RETURN 
CALCULATE(
    SUM( 'Table'[Duration] ),
    ALLSELECTED( 'Table' ), 
    'Table'[Duration] <= __maxDuration 
)

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

 

Anonymous
Not applicable

@Mariusz  Thank you it works, but when they are repetitive values it doesn't sum up until value changes.

For example;
Value   Cumulative.Sum
35         35  
17         52  
15         67 
11         78  
7           92
7           92
3           104

3           104
3           104
3           104
2           106


How can I convert first 92 to 85?

az38
Community Champion
Community Champion

@Anonymous 

what's rule do you want to define whats 7 is the first, whats is the second?

its impossible do correct without any additional dimension

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Hello @az38 

I added the correct version of what I want.
Is it impossible?

 

For example;
Value   Cumulative.Sum(Wrong)  Cumulative.Sum(Correct)
35                    35                                          35
17                    52                                          52
15                    67                                          67
11                    78                                          78                                                                                
7                      92                                          85
7                      92                                          92
3                      104                                        95

3                      104                                        98 
3                      104                                        101
3                      104                                        104
2                      106                                        106 

az38
Community Champion
Community Champion

@Anonymous 

I dont see a way to split 7's values in your data model without addition any other order column

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

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.

Top Solution Authors