Forum Discussion
sonya7
3 years agoHelper III
12 month rolling average
I have Amount data based on Startdate date. How can I write the 12-month average? i'm new, it is important to me that you are clear 🙏 thanks
- 3 years ago
Anonymous
3 years agoNot applicable
Hi sonya7 ,
You can refer the following links to get it:
Rolling 12 Months Average in DAX
Sales R12M =
VAR NumOfMonths = 12
VAR LastCurrentDate =
MAX ( 'Date'[Date] )
VAR Period =
DATESINPERIOD ( 'Date'[Date], LastCurrentDate, - NumOfMonths, MONTH )
VAR Result =
CALCULATE (
AVERAGEX (
VALUES ( 'Date'[Calendar Year Month] ),
[Sales Amount]
),
Period
)
VAR FirstDateInPeriod = MINX ( Period, 'Date'[Date] )
VAR LastDateWithSales = MAX ( Sales[Order Date] )
RETURN
IF ( FirstDateInPeriod <= LastDateWithSales, Result )