Forum Discussion
Having trouble plotting a moving average
- 7 years ago
Hi Anonymous,
It's always a good idea to create a Date table for the Time Intelligence functions. Because the fact table could have discontinuous dates, the MAX(MY_TABLE[CREATEDDATE]) may not the end of a week.
1. Create a Date table.
Calendar = ADDCOLUMNS(CALENDARAUTO(), "WeekNum", WEEKNUM([Date], 2)
2. Establish a relationship.
3. The measure could be like below.
MovAvg = CALCULATE ( COUNTA ( MY_TABLE[CASENUMBER] ), DATESINPERIOD ( calendar[DATE], MAX ( calendar[DATE] ), -14, DAY ) ) / 2
Best Regards,
Dale
Hi Anonymous,
It's always a good idea to create a Date table for the Time Intelligence functions. Because the fact table could have discontinuous dates, the MAX(MY_TABLE[CREATEDDATE]) may not the end of a week.
1. Create a Date table.
Calendar = ADDCOLUMNS(CALENDARAUTO(), "WeekNum", WEEKNUM([Date], 2)
2. Establish a relationship.
3. The measure could be like below.
MovAvg = CALCULATE ( COUNTA ( MY_TABLE[CASENUMBER] ), DATESINPERIOD ( calendar[DATE], MAX ( calendar[DATE] ), -14, DAY ) ) / 2
Best Regards,
Dale
- v-jiascu-msft7 years agoMicrosoft Employee
Hi Anonymous,
That's because it is a table formula. You need to create a new table with it. Please refer to the snapshot below.
Best Regards,
Dale