Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Sum last value filtered by date

Hello, I need to get the last CUMULATIF value for each single NO_PALETTE filterd by the choosen date. The date slicer is coming from a calendar table. Then I want to sum all the value the get the to...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Anonymous Your measures needs to sum up the across all distinct values of NO_PALETTE, like this:

     

    Qty(filter)_test = 
        SUMX(
            VALUES(HIST_PAL[NO_PALETTE]),
            var dateselect = SELECTEDVALUE(Dimdate[Date])
            var minindex = CALCULATE(MIN(HIST_PAL[Index]),HIST_PAL[DATE] <= dateselect,ALLEXCEPT(HIST_PAL,HIST_PAL[NO_PALETTE]))
            Return
            CALCULATE(SUM(HIST_PAL[CUMULATIF]),HIST_PAL[Index] = minindex)
        )