cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sachy123 Regular Visitor
Regular Visitor

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

Accepted Solutions
Super User
Super User

Re: Cumulative total for a simple table

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. 

3 REPLIES 3
HotChilli New Contributor
New Contributor

Re: Cumulative total for a simple table

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

Re: Cumulative total for a simple table

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. 

Sachy123 Regular Visitor
Regular Visitor

Re: Cumulative total for a simple table

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

Helpful resources

Announcements
Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Summit Australia 2019

Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

PBI Community Highlights

PBI Community Highlights

Check out what's new in the Power BI Community!

Top Ideas
Users Online
Currently online: 100 members 1,682 guests
Please welcome our newest community members: