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
NI
New Member

Running Total by date based on value in another column

I want a running total by date for the Amount Column which should be different for each Security ID.Capture.PNG

 

2 ACCEPTED SOLUTIONS
Zubair_Muhammad
Community Champion
Community Champion

Hi @NI

 

First add an Index Column from Query Editor or Power Query

 

6500.png


Regards
Zubair

Please try my custom visuals

View solution in original post

@NI

 

Now you can get the expected Cumulative  Values using this Calculated Column

 

Cumulative =
CALCULATE (
    SUM ( TableName[Amount] ),
    FILTER (
        ALLEXCEPT ( TableName, TableName[Security ID] ),
        TableName[Index] <= EARLIER ( TableName[Index] )
    )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

Hi @NI

 

First add an Index Column from Query Editor or Power Query

 

6500.png


Regards
Zubair

Please try my custom visuals

@NI

 

Now you can get the expected Cumulative  Values using this Calculated Column

 

Cumulative =
CALCULATE (
    SUM ( TableName[Amount] ),
    FILTER (
        ALLEXCEPT ( TableName, TableName[Security ID] ),
        TableName[Index] <= EARLIER ( TableName[Index] )
    )
)

Regards
Zubair

Please try my custom visuals

hi @Zubair_Muhammad 

I have a follow up qustion about your amazing explanation, 

let's assume I have another "Country" column at the table, which I want to take as a paramater while calculating the running total, so that the cumulative total column will show not only cumulative total over time by securtiy Id but also by country, like in the example below- how should I revise the calculation in order to do so? 

 

Thanks ! 

 

Test.PNG

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