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
Sachy123
Helper V
Helper V

Cumulative total for a simple table

I have following simple table :
 
Scale = DATATABLE("Scale",INTEGER,{{1},{1000},{1000000}}) 

 

Now , I just want to add one more column to it , so that I can get a cumulative sum like 1, 1001, 1001001 

 

So I added the following measure.. but it seems not be working - Can somoene please help!

 

RunningTotal = CALCULATE(Sum(Scale[Scale]),FILTER(Scale,Scale[Scale]<=VALUE(Scale[Scale])))
1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Hello @Sachy123 ,

We just need to feed it the current row in a variable and use it to filter our sum:

Running Total = 
VAR RowScale = Scale[Scale]
RETURN
    CALCULATE ( 
        SUM ( Scale[Scale] ),
        Scale[Scale] <= RowScale
    )

*Removed the unneeded filter. 

View solution in original post

3 REPLIES 3
jdbuchanan71
Super User
Super User

Hello @Sachy123 ,

We just need to feed it the current row in a variable and use it to filter our sum:

Running Total = 
VAR RowScale = Scale[Scale]
RETURN
    CALCULATE ( 
        SUM ( Scale[Scale] ),
        Scale[Scale] <= RowScale
    )

*Removed the unneeded filter. 

I was just not able to refer to the current row-- thanks for this tip

HotChilli
Super User
Super User

RunningTotal = CALCULATE(Sum(Scale[Scale]),FILTER(ALL(Scale), Scale[Scale] <= MAX(Scale[Scale])))

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.