Forum Discussion

kadapavel's avatar
kadapavel
Helper II
7 years ago
Solved

Rolling total since specific date

Hi, could you please help me to fix my measure. I would calculate rolling total since one specific date fatigue_test = CALCULATE( SUM('KPI_Indices'[Wearout with min damage]), FILTER( ALL(KP...
  • Anonymous's avatar
    Anonymous
    7 years ago

    HI kadapavel ,

    You can consider to add a if statement with conditions to compare current date and specific date:

    POwer bi DAX =
    VAR currDate =
        MAX ( 'Sheet1'[ResultDate] )
    VAR selected = 'specific datevalue'
    RETURN
        CALCULATE (
            SUM ( 'Sheet1'[Result] ),
            FILTER (
                ALL ( Sheet1 ),
                IF (
                    currDate < selected,
                    'Sheet1'[ResultDate] <= currDate,
                    'Sheet1'[ResultDate] >= selected
                        && 'Sheet1'[ResultDate] <= currdate
                )
            )
        )
    

    Regards,

    Xiaoxin Sheng