Forum Discussion
Rolling Calculation
- 9 years ago
Hi,
Unfortunately this website is blocked by our internbet security, so I am unable to view.
However, thanks to Bhavesh Patel, I have managed to understand the process more and seem to have found my solution:
NEWTEST_C = CALCULATE([TotalWorkingDaysActual_M],
DATESINPERIOD('KPI_ABS'[Month_Year],
LASTDATE('KPI_ABS'[Month_Year]),-11,MONTH
))This gives me the result I need each month.
Thank you Bhavesh for your patience and help.
Kind Regards
Rich.
Hi There,
Date Table has a specific role in DAX Time intelligence calculations as It contains unique records of all the dates which is neccessary for the correct working of the time intelligence functions in DAX.
For creating a rolling 12 month average, there are variety of different ways you can deploy DAX Calculation.
Thanks & Regards,
Bhavesh
Hope this would clarify your understanding.
Thanks & Regards,
Bhavesh
It is this section I seem to struggle resolving:
Date[DateKey],
CALENDAR (DATE(2000,1,1), DATE(2025,12,31)),
"DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ),
"Year", YEAR ( [Date] ),
"Monthnumber", FORMAT ( [Date], "MM" ),
"YearMonthnumber", FORMAT ( [Date], "YYYY/MM" ),
"YearMonthShort", FORMAT ( [Date], "YYYY/mmm" ),
"MonthNameShort", FORMAT ( [Date], "mmm" ),
"MonthNameLong", FORMAT ( [Date], "mmmm" ),
"DayOfWeekNumber", WEEKDAY ( [Date] ),
"DayOfWeek", FORMAT ( [Date], "dddd" ),
"DayOfWeekShort", FORMAT ( [Date], "dddd" ),
"Quarter", "Q" & FORMAT ( [Date], "Q" ),
"YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" )
)
Rolling Average 12 Months = CALCULATE (
SUM('KPI_ABS'[WorkingDaysActual_C],
DATESBETWEEN (
Date[Month_Year],
NEXTDAY ( SAMEPERIODLASTYEAR ( LASTDATE ( Date[DateKey] ) ) ),
LASTDATE ( Date[DateKey] )
)
)
I also see samples that start with Calendar, I feel stupid as I just can't work this one, I seem to hit a brick wall in my head!