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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
TimmK
Helper IV
Helper IV

Remove Months from Cumulative Total

I use the following measure to get my cumulative total:
Measure = CALCULATE([Cash],FILTER(ALL('Date'),'Date'[Date]<=MAX('Date'[Date])))
 
It generally works fine. However, in the visual months are displayed that have not been reached yet (in this case October, November, December 2022).
 
How can I adapt my measure so that these months are not included in the visual?
 
TimmK_0-1663054083159.png

 

Also, how I can I also accomplish the same by using relative date in the visual? I can for example select in the last 100 calendar months, but not in the last 100 calendar months AND the current calender month. How can I include the current calendar month?
 
TimmK_1-1663054143505.png

 

1 ACCEPTED SOLUTION

@TimmK 
Then try

 

Measur =
IF (
    MIN ( 'Date'[Date] ) <= TODAY (),
    CALCULATE ( [Cash], 'Date'[Date] <= MAX ( 'Date'[Date] ), ALL ( 'Date' ) )
)

*Edited

Changed MAX to MIN in the IF statement

 

View solution in original post

6 REPLIES 6
tamerj1
Super User
Super User

Hi @TimmK 
Please try

 

Measur =
CALCULATE (
    [Cash],
    'Date'[Date] <= MIN ( 'Date'[Date] ),
    'Date'[Date] <= TODAY (),
    ALL ( 'Date' )
)

 

I just tried it, but it results in exactly the same as previously, I still see the months October, November, December 2022 in the visual.

@TimmK 
Then try

 

Measur =
IF (
    MIN ( 'Date'[Date] ) <= TODAY (),
    CALCULATE ( [Cash], 'Date'[Date] <= MAX ( 'Date'[Date] ), ALL ( 'Date' ) )
)

*Edited

Changed MAX to MIN in the IF statement

 

Thank you very much. 🙂

 

It works with MAX.

 

I adapted the solution a bit and now it works as it should:

IF(
MAX( 'Date'[YM] ) > FORMAT( TODAY(), "YYYYMM" ),
BLANK(),
CALCULATE([Cash], FILTER( ALL( 'Date' ), 'Date'[Date] <= MAX( 'Date'[Date] ) )
))

 

amitchandak
Super User
Super User

@TimmK , Assume you have table with date

 

Measure =

var _max = maxx(allselected(Table), Table[Date])

return

CALCULATE([Cash],FILTER(ALL('Date'),'Date'[Date]<=MAX('Date'[Date]) && 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

Thanks, I tried it, but it did not work, the result is the same as before.

 

var _max = MAXX(ALLSELECTED(Cash),Cash[Datum])

RETURN
CALCULATE([Cash],FILTER(ALL('Date'),'Date'[Date]<=MAX('Date'[Date]) && 'Date'[Date]<=_max))

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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