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

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

Reply
LeaRupnik
Helper III
Helper III

cumulative with filter

I have a problem calculating the cumulative. I would like it to be calculated according to the filter, which means that if I chose the month of January, I find it good if I choose the month of February, I should get sumo January + February, then if I choose March, I should get sumo January + February + March

 

now i have a dax formula like this:

KUM REAL:= var leto = MAX('planir planirano'[mesec])
return
CALCULATE([REAL],
ALLSELECTED('planir planirano'), 'planir planirano'[mesec]<= leto,
VALUES('planir planirano'[Sistem Impol]),
VALUES('planir planirano'[Naziv firma]),
VALUES('planir planirano'[Naziv programa]),
VALUES('planir planirano'[Naziv programske enote]),
VALUES('planir planirano'[int_ext]),
VALUES('planir planirano'[vrsta_mereid]),
VALUES('planir planirano'[leto]))

 

vizualization like this: 

LeaRupnik_2-1622101495671.png

 

please help

 

thx Lea

 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @LeaRupnik ,

 

Try this:

Measure =
CALCULATE (
    SUM ( 'Table'[Sales] ),
    DATESBETWEEN (
        Dates[Date],
        DATE ( YEAR ( MAX ( Dates[Date] ) ), 1, 1 ),
        MAX ( Dates[Date] )
    )
)

 

Or this:

Measure = 
CALCULATE (
    SUM ( 'Table'[Sales] ),
    DATESBETWEEN (
        Dates[Date],
        STARTOFYEAR ( Dates[Date] ),
        MAX ( Dates[Date] )
    )
)

cumulative.gif

 

 

Best Regards,

Icey

 

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

2 REPLIES 2
Icey
Community Support
Community Support

Hi @LeaRupnik ,

 

Try this:

Measure =
CALCULATE (
    SUM ( 'Table'[Sales] ),
    DATESBETWEEN (
        Dates[Date],
        DATE ( YEAR ( MAX ( Dates[Date] ) ), 1, 1 ),
        MAX ( Dates[Date] )
    )
)

 

Or this:

Measure = 
CALCULATE (
    SUM ( 'Table'[Sales] ),
    DATESBETWEEN (
        Dates[Date],
        STARTOFYEAR ( Dates[Date] ),
        MAX ( Dates[Date] )
    )
)

cumulative.gif

 

 

Best Regards,

Icey

 

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

FarhanAhmed
Community Champion
Community Champion

You can use TotalYTD to create Cumulative measure based on YTD Values.

 

 

YTD = TOTALYTD([MeasureName],’Calendar'[Date])

 

 

Ref: https://docs.microsoft.com/en-us/dax/totalytd-function-dax

Ref 2 : https://www.sqlbi.com/blog/marco/2018/08/10/the-hidden-secrets-of-totalytd/

 

 







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

Proud to be a Super User!




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.

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.