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

Need help on Cumulative Sum to Stop at last value

Hi there, my cumulative sum is extending to further dates where there are blank values. I need it to stop when there is no more data. I am specifically looking at the green line in the chart on the left and the red/green lines on the right

Thank you

Baseline Weekly =
CALCULATE(
SUM(fact_Progress[Value]),
FILTER(ALLSELECTED(dim_Date),dim_Date[CurWeekOffset] <= MAX(dim_Date[CurWeekOffset])),
FILTER(ALLSELECTED(fact_Progress),fact_Progress[Type]="Target"))

Capture.JPG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I got it. here is what I did (note table names are slightly different from original). I am guessing it is because my primary table had additional dates beyond the max target date, so I included a filter on the original max date calculation for "target" only. Thank you for your help

 

 

Original Baseline Weekly2 = 
VAR MaxDate = CALCULATE(MAX(fact_ManhourProgress[Date]),FILTER(fact_ManhourProgress,fact_ManhourProgress[Type]="Target"))
RETURN
    CALCULATE (
        SUM ( fact_ManhourProgress[Value] ),
        FILTER (
            ALLSELECTED ( dim_Date ),
            dim_Date[Date] <= MaxDate
        ),
        FILTER ( ALLSELECTED ( fact_ManhourProgress ), fact_ManhourProgress[Type] = "Target" )
    )

 

View solution in original post

6 REPLIES 6
MFelix
Super User
Super User

Hi  @Anonymous ,

 

Try to add the following code:

 

Baseline Weekly =
IF (
    MAX ( dim_Date[CurWeekOffset] )
        >= CALCULATE ( MAX ( fact_Progress[Date] ), ALL ( fact_Progress[Date] ) ),
    BLANK (),
    CALCULATE (
        SUM ( fact_Progress[Value] ),
        FILTER (
            ALLSELECTED ( dim_Date ),
            dim_Date[CurWeekOffset] <= MAX ( dim_Date[CurWeekOffset] )
        ),
        FILTER ( ALLSELECTED ( fact_Progress ), fact_Progress[Type] = "Target" )
    )
)

Replace the fact_Progress[Date] by the column date of your fact_progress.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

I get the same result with that formula as my previous. Any other solutions?

Hi,

Can you share a sample file please.

Regards,
MFelix

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

I can't share a sample file. The current week offset of my dim_date table is a numeric number based on the # of days from present (yesterday is -1, today is 0, tomorrow is +1). Could this be the problem with your formula?

Hi @Anonymous ,

 

Without any other information about your model is difficult to help you.

 

Can you share the way your model is setup and a sample of the information so I can make some tests?

 

If you don't want to share the file because it's sensitive information you can do it through private message or make a mockup file with the structure and sample data.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

I got it. here is what I did (note table names are slightly different from original). I am guessing it is because my primary table had additional dates beyond the max target date, so I included a filter on the original max date calculation for "target" only. Thank you for your help

 

 

Original Baseline Weekly2 = 
VAR MaxDate = CALCULATE(MAX(fact_ManhourProgress[Date]),FILTER(fact_ManhourProgress,fact_ManhourProgress[Type]="Target"))
RETURN
    CALCULATE (
        SUM ( fact_ManhourProgress[Value] ),
        FILTER (
            ALLSELECTED ( dim_Date ),
            dim_Date[Date] <= MaxDate
        ),
        FILTER ( ALLSELECTED ( fact_ManhourProgress ), fact_ManhourProgress[Type] = "Target" )
    )

 

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