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
Syndicate_Admin
Administrator
Administrator

Cumulative total between two selected dates

Hello

You would need to calculate the total accumulated by months and years of a value but that is between two segmented dates (start and end) and that when the year changes it starts from 0.

I have that to this extent and it works well.

Cumulative measure =
CALCULATE(SUM(Sheet1[Value]),FILTER(ALL(Hoja1),Hoja1[Fecha_A]<=MAX(Hoja1[Fecha_A]) && Sheet1[Year]=MAX(Sheet1[Year])))
This he does well.
kikejnt89_1-1648464832399.png

But I want to put additionally in the measure and without creating a segmentation that makes me the calculation between two specific dates. A specific start date and a specific end date in the same column (Date A).

Example pbix attachment.

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @Syndicate_Admin ;

You could try it.

Cumulative measure =
IF (
    ISINSCOPE ( 'Sheet1'[Year] ),
    CALCULATE (
        SUM ( Sheet1[Value] ),
        FILTER (
            ALL ( Hoja1 ),
            Hoja1[Fecha_A] <= MAX ( Hoja1[Fecha_A] )
                && Sheet1[Year] = MAX ( Sheet1[Year] )
        )
    ),
    SUM ( Sheet1[Value] )
)


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @Syndicate_Admin ;

You could try it.

Cumulative measure =
IF (
    ISINSCOPE ( 'Sheet1'[Year] ),
    CALCULATE (
        SUM ( Sheet1[Value] ),
        FILTER (
            ALL ( Hoja1 ),
            Hoja1[Fecha_A] <= MAX ( Hoja1[Fecha_A] )
                && Sheet1[Year] = MAX ( Sheet1[Year] )
        )
    ),
    SUM ( Sheet1[Value] )
)


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Syndicate_Admin , Try using allselected

 

CALCULATE(SUM(Sheet1[Value]),FILTER(ALLselected(Hoja1),Hoja1[Fecha_A]<=MAX(Hoja1[Fecha_A]) && Sheet1[Year]=MAX(Sheet1[Year])))

 

Also, you can force like this example

Cumm Sales =
var _max = maxx(allselected(Date),Date[Date])
var _min = mainx(allselected(Date),Date[Date])
return

CALCULATE(SUM(Sales[Sales Amount]),filter(allselected('Date'),'Date'[date] <=max('Date'[date]) && 'Date'[Date] >=_min && 'Date'[Date] <=_max ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Using allselected() worked for me. Thank you so much!

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors