Nirmalya Roy
Nirmalya Roy

Reputation: 13

Moving annual total in dax

How do I calculate mat in dax for same period last year. Suppose current mat will be calculated for 2018 Aug - 2019 sep Same period last year will be calculated for 2017 Aug - 2018 sep

Upvotes: 0

Views: 3228

Answers (1)

greggyb
greggyb

Reputation: 3798

If you have a working [MAT] like in your comment, you should be able to just wrap it in a CALCULATE with SAMEPERIODLASTYEAR. See below:

MAT =
CALCULATE (
    SUM ( 'SillyFact'[Amount] ), 
    DATESINPERIOD ( 'DimDate'[Date], LASTDATE ( 'DimDate'[Date] ), -1, YEAR )
)

MAT Prior = CALCULATE( [MAT], SAMEPERIODLASTYEAR ('DimDate'[Date] ) )

See them working below in a dummy model:

MAT and MAT Prior

Upvotes: 1

Related Questions