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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Cumulative Running Total with Missing Values

Hi, Im fairly new to Power BI and I'm struggling to work out how to avoid my cumulative/YTD running total line graph dipping back down to zero when I don't have any values in a particular month. It should stay at the previous months YTD figure. 

 

My current measure is as follows:

 

YTD Cumulative = calculate([Total Agreements],FILTER(ALLSELECTED (agreements),([executiondate] <= MAX(agreements[executiondate]))),GROUPBY('Date','Date'[Fiscal Year]))

 

where Total Agreements = if(COUNTROWS(agreements) = BLANK(), 0, COUNTROWS(agreements))

 

The graph currently looks like this:

 

Capture.PNG

As you can see the line at Dec 2016 dips back down to zero (because there were no occurances in that month) before going back up in January, but it should stay as a horizontal line in reality as the YTD total remains the same.

 

I did have Total Agreements = COUNTROWS(agreements), but that gave me a broken line graph (which is also wrong), hence the addition of the IF statement. 

 

If it is important to know, the data is coming from Dynamics.

 

Any thoughts would be very gratefully received.

 

Thanks!

2 REPLIES 2
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Please try this:

Total Agreements = COUNTROWS(agreements)

YTD Cumulative =
IF (
    COUNTROWS ( agreements ) = BLANK (),
    CALCULATE (
        [Total Agreements],
        FILTER (
            ALLSELECTED ( agreements ),
            (
                MONTH ( [executiondate] )
                    <= MONTH ( MAX ( agreements[executiondate] ) ) - 1
            )
        ),
        GROUPBY ( 'Date', 'Date'[Fiscal Year] )
    ),
    CALCULATE (
        [Total Agreements],
        FILTER (
            ALLSELECTED ( agreements ),
            ( [executiondate] <= MAX ( agreements[executiondate] ) )
        ),
        GROUPBY ( 'Date', 'Date'[Fiscal Year] )
    )
)

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi there @v-yulgu-msft,

 

Thanks for looking into this problem for me, but unfortunately that doesn't seem to be working as that gives me a broken line for that missing month.

 

I created 2 new measures called v2Total Agreements & v2YTD Cumulative (rather than changing my current ones) and this is how the graph now looks and I created a table to show the actual figures for my original measures and the new ones:

 

 

 

Capture.PNGCapture2.PNG

 

As you can see there is no figure for v2YTD Cumulative for December Fiscal Year 2016, I'm trying to get it to say 21 (which is the same figure for November).

 

Really appreciate you looking into this for me.

 

Just to confirm here is the new measure created:

 

v2YTD Cumulative =
IF (
COUNTROWS ( agreements ) = BLANK (),
CALCULATE (
[v2Total Agreements],
FILTER (
ALLSELECTED ( agreements ),
(
MONTH ( [executiondate] )
<= MONTH ( MAX ( agreements[executiondate] ) ) -1
)
),
GROUPBY ( 'Date', 'Date'[Fiscal Year] )
),
CALCULATE (
[v2Total Agreements],
FILTER (
ALLSELECTED ( agreements ),
( [executiondate] <= MAX ( agreements[executiondate] ) )
),
GROUPBY ( 'Date', 'Date'[Fiscal Year] )
)
)

 

Thanks,

Andy

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors