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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.