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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
divsforeal
Frequent Visitor

Calculate a Cumulative Sum and add it to a measure's last value (latest Date)

Hey 

 

I have a tricky situation. (attached example below) 

I have data coming from one measure until december 2021, but from jan 2022 the data is coming from another measure.

Using if clause i combined both measures based on date field.

But now, the end user wants to create a cumulative sum of the last value of Measure1 + First value of Measure 2 (by Date)

Please help me create a dax for this scenario.

My current measure is as follows:

 

Final Measure(required Output) = Calculate((Measure2), Table1[Date] <= Max[Table1[Date]]) + Measure 2

 

Thanks in advance.

 

community 1.PNGcommunity 2.PNG

 

 

 

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @divsforeal 

According to the description I created the following model, you can try a measure like this

cul = 
VAR _lastDate =
    MAXX ( Fact2021, Fact2021[Date] )
VAR _lastvalue =
    MAXX ( FILTER ( 'Fact2021', Fact2021[Date] = _lastDate ), [Value] )
VAR _culvalue =
    SUMX (
        FILTER ( ALL ( Fact2022 ), Fact2022[Date] <= MIN ( 'Table'[Date] ) ),
        [Value]
    )
RETURN
    IF ( YEAR ( MIN ( 'Table'[Date] ) ) > 2021, _culvalue + _lastvalue )

vxiaotang_0-1652334521932.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @divsforeal 

According to the description I created the following model, you can try a measure like this

cul = 
VAR _lastDate =
    MAXX ( Fact2021, Fact2021[Date] )
VAR _lastvalue =
    MAXX ( FILTER ( 'Fact2021', Fact2021[Date] = _lastDate ), [Value] )
VAR _culvalue =
    SUMX (
        FILTER ( ALL ( Fact2022 ), Fact2022[Date] <= MIN ( 'Table'[Date] ) ),
        [Value]
    )
RETURN
    IF ( YEAR ( MIN ( 'Table'[Date] ) ) > 2021, _culvalue + _lastvalue )

vxiaotang_0-1652334521932.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

You cannot measure a measure.  Your cumulative needs to be calculated in a new, independent measure. Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. Avoid posting screenshots of your source data if possible.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors