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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Kristian_nho
Helper I
Helper I

Cumulative sum not working

Hello all,

 

I have been through various answers on this page but non of them could help me so far.

The reqest is to show a dynamic running cumulative total that could be sliced with date slicers (year, month etc.).

 

The following formula works but it calculates the cumulative total from the first day in the table and does not take into account the date slicer:

 

 

GSV RT = 
VAR MinDate = MIN('Accounting Date'[Accounting Date])
VAR MaxDate = MAX('Accounting Date'[Accounting Date])

RETURN
CALCULATE(
    [GSV],
    FILTER(
        ALLSELECTED('Accounting Date'[Accounting Date]),
        'Accounting Date'[Accounting Date] <= MaxDate
    )
)

 

 

- when the year slicer is applied, the first day contains the cumulative total of the past years (30,000 in the table below) as well so it doesn't start from 0

 

DateGSVGSV RT CurrentGSV RT Correct
1/1/2021130,0011
2/1/202110030,101101
3/1/202110030,201201
4/1/202120030,401401

 

 

When I use the formula below, the cumulative sum stops working alltogether and the data is shown as if I used the SUM(Sales table [GSC]) instead:

 

 

GSV RT = 
VAR MinDate = MIN('Accounting Date'[Accounting Date])
VAR MaxDate = MAX('Accounting Date'[Accounting Date])

RETURN
CALCULATE(
    [GSV],
    FILTER(
        ALLSELECTED('Accounting Date'[Accounting Date]),
        'Accounting Date'[Accounting Date] <= MaxDate &&
        'Accounting Date'[Accounting Date] >= MinDate
    )
)

 

 

 

DateGSVGSV RT CurrentGSV RT Correct
1/1/2021111
2/1/2021100100101
3/1/2021100100201
4/1/2021200200401

 

I have tried using 'ALL' instead of 'ALLSELECTED' as well but with no change whatsoever.

 

Any advice is greatly appreciated.

1 REPLY 1
Anonymous
Not applicable

Of course ALL and ALLSELECTED in this case return the same results. If you want to know why... you'll have to read this: The definitive guide to ALLSELECTED - SQLBI

 

Also, it really does matter which columns you use in your formulas, which columns have filters placed on them and what the relationships are. It really does matter.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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