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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
adsam
Frequent Visitor

Cumulative total with condition

Hi, 

 

I m trying to get cumulative total of "Forecast Gross" once "Closing stock" end e.g. Last Closing stock date is 18/03/24 so Forecast should start cumulating from 18/03, I was able to calculate demand after last closing stock date but it is not cumulating. below is the measure. 

Demand Cumulative:=VAR LastClosingStk = CALCULATE(MAX([Transaction Date]),'Date'[DateWithSales] = TRUE,ALL('Date'))
			VAR Result = CALCULATE([Forecast Gross],FILTER('Date','Date'[Date]>=LastClosingStk))
			Return Result

https://1drv.ms/x/s!Agco7LD2yJqrpXn-v3X8sw9g36vt 

image (2).png

1 ACCEPTED SOLUTION
Daoud_H
Helper I
Helper I

Hi @adsam,

 

Try to update your measure like this : 

Demand Cumulative:=
VAR LastClosingStk = CALCULATE(MAX([Transaction Date]),'Date'[DateWithSales] = TRUE,ALL('Date'))
VAR CurrentDate = MAX('Date'[Date])
RETURN
    CALCULATE(
        [Forecast Gross],
        FILTER(
            ALL('Date'),
            'Date'[Date] <= CurrentDate && 'Date'[Date] >= LastClosingStk
        )
    )

 

 

View solution in original post

2 REPLIES 2
adsam
Frequent Visitor

Thanks it worked

Daoud_H
Helper I
Helper I

Hi @adsam,

 

Try to update your measure like this : 

Demand Cumulative:=
VAR LastClosingStk = CALCULATE(MAX([Transaction Date]),'Date'[DateWithSales] = TRUE,ALL('Date'))
VAR CurrentDate = MAX('Date'[Date])
RETURN
    CALCULATE(
        [Forecast Gross],
        FILTER(
            ALL('Date'),
            'Date'[Date] <= CurrentDate && 'Date'[Date] >= LastClosingStk
        )
    )

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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