DAX : Calculate average for Last 4 weeks

Hi All

if you have average measure and needs to calculate for last 4 weeks then create DAX like shown below using DATESINPERIOD function


Average of last 4 weeks = CALCULATE([Average For Report Period],DATESINPERIOD('Date'[Day],LASTDATE('Date'[Week Ending]),-28,DAY))



Average of last 12 weeks = CALCULATE([Average For Report Period],DATESINPERIOD('Date'[Day],LASTDATE('Date'[Week Ending]),-84,DAY))

Comments

Popular posts from this blog

SQL Server MDS : How to Know Actual MDS Table name for Model Entity and Column name for the Attribute

SSIS Error : Object is not an ADODB.RecordSet or an ADODB.Record + Solution

SSRS : [Teradata Database] 3939 There is a mismatch between the number of parameters specified and the number of parameters required.