Forum Discussion

adsam's avatar
adsam
Frequent Visitor
2 years ago
Solved

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 calcula...
  • Daoud_H's avatar
    2 years ago

    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
            )
        )