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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
rsrgerge
Regular Visitor

Modifying Cumulative Measure

HI,

 

I want try and modify the below cumulative measure to ignore dates after a certain point (Today's date). The measure provides a cumulative sum of a value against the report date. I want to try and stop it after a certain point as it is using dates which aren't required.

 

Cash In =
CALCULATE(
    SUM('Cash_View'[Amount]),
    FILTER(
        ALLSELECTED('Cash_View'[Report Date]),
        ISONORAFTER('Cash_View'[Report Date], MAX('Cash_View'[Report Date]), DESC)
       
    ),Cash_View[InOut]="Cash In"
)
 
 
Thanks for any and help provided
1 ACCEPTED SOLUTION
pankaj_lp
Helper I
Helper I

Try using this :

Cash In Cumulative =
VAR MaxReportDate = MAX('Cash_View'[Report Date])
VAR CutOffDate = TODAY()

RETURN
CALCULATE(
SUM('Cash_View'[Amount]),
FILTER(
ALLSELECTED('Cash_View'[Report Date]),
ISONORAFTER('Cash_View'[Report Date], MaxReportDate, DESC)
&& 'Cash_View'[Report Date] <= CutOffDate
),
'Cash_View'[InOut] = "Cash In"
)

View solution in original post

9 REPLIES 9
pankaj_lp
Helper I
Helper I

try changing the maxreportdate to today() itself

 

It has the same effect, it flattens the line and can't correctly plot the week by week cumulative sum 

rsrgerge_0-1689769967404.png

 

@pankaj_lp 

 

Solved it thanks to your help, I realised i had to apply the filter to the variable to get the Max Report Date relative to that value type. Thanks for your help!

MaxReportDate = CALCULATE(MAX(Cash_View[Report Date]),Cash_View[InOut]="Cash In")
pankaj_lp
Helper I
Helper I

What is date filter used in this case, any date slicer used?

 

Hi @pankaj_lp ,

 

No there's no other date filters used, as an update, i tried to change MaxReportDate to 

CALCULATE(MAX(EXVW_Cash_Combined[Report Date]),EXVW_Cash_Combined[Report Date]<TODAY()), however this prevents the line from plotting the cumulative values for each [Report Date] and just gives the total

rsrgerge_0-1689769096611.png


The data table looks like this, its just amounts with "Cash In/Cash Out" for transactions which have taken place, and "Forecast In/Forecast Out" for future amounts. The [Report Date] is a week commencing date

 

rsrgerge_1-1689769386662.png

 

pankaj_lp
Helper I
Helper I

Try using this :

Cash In Cumulative =
VAR MaxReportDate = MAX('Cash_View'[Report Date])
VAR CutOffDate = TODAY()

RETURN
CALCULATE(
SUM('Cash_View'[Amount]),
FILTER(
ALLSELECTED('Cash_View'[Report Date]),
ISONORAFTER('Cash_View'[Report Date], MaxReportDate, DESC)
&& 'Cash_View'[Report Date] <= CutOffDate
),
'Cash_View'[InOut] = "Cash In"
)

Thanks for the reply @pankaj_lp , so i've used the DAX above. It still seems to be using the maximum date from the table (25/09/2023) instead of using "CutOffDate". 

rsrgerge_0-1689768172743.png

 

For context, this measure is going on a line graph with other similar measures filtered by different [InOut] values, e.g. "Cash In", "Cash Out".etc.

 

rsrgerge_1-1689768252973.png

 

Apply a filter to the datasource as a whole isn't possible in this scenario as some of the measures do need to take into account a date beyond today for "Forecast" values

 

 

Neil

 

rsrgerge
Regular Visitor

Hi

@pankaj_lp 

 

 

Yes it'd be todays date.

 

Neil

pankaj_lp
Helper I
Helper I

what exactly is the certain point, is there a fixed date?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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