0
votes

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

1
Do you have a working MAT for current year that you're looking to modify? If yes, take a look at PARALLELPERIOD or SAMEPERIODLASTYEAR or DATEADD or PREVIOUSYEARgreggyb
Mat = calculate ( order (sum), datesinperiod (date[date],lastdate(date[date]),-1,yea r).now to calculate if I use 1 instead of -1, does that workNirmalya Roy

1 Answers

1
votes

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