Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Trailing 365 Daily Total

Hello,    I need to add a calculated column to a table that adds the total in the Amount column for ALL rows with a Date within the last 365 days of each row. I have tried numerous different DAX fo...
  • Fowmy's avatar
    5 years ago

    Anonymous 

    This is your 1st measure:

    Last 365 =
    CALCULATE (
        SUM ( MyTable[Sales] ),
        DATESINPERIOD ( MyTable[Date], MAX ( MyTable[Date] ), -365, DAY )
    )
    


    The 2nd measure:

    Diff =
    [Last 365]
        - CALCULATE (
            SUM ( MyTable[Sales] ),
            DATESINPERIOD ( MyTable[Date], MAX ( MyTable[Date] ) - 1, -365, DAY )
        )