Forum Discussion
Convert a table without date into a 6 Month (6 steps Moving Average
- Anonymous5 years ago
Hi Applicable88
I know you want to calculate the 6 month rolling average of sum of percentages. And your Date column is not in date type.
Try my way to achieve your goal. I build a sample data model like yours to have a test.
Sample:
Add a Rank column by dax, and we don't need to use date type column.
Rank = RANKX('Table','Table'[YearMonthKey],,ASC,Dense)Measure:
Rolling 6 Avg = VAR _EndRank = MAX('Table'[Rank]) VAR _StartRank = _EndRank-6 VAR _Rolling6Sum = SUMX(FILTER(ALL('Table'),'Table'[Rank]<=_EndRank&&'Table'[Rank]>_StartRank),'Table'[Percentage]) VAR _Avg = DIVIDE(_Rolling6Sum,6) Return _AvgResult is as below. Rolling 6 Avg in 202105 = 55,60%.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello amitchandak ,
I followed your instruction. Datetable is marked, YearMonthKey is also a column in that DateTable.
I got this return:
I changed your function according to my values and used the average function:
I have the same issue with yours.
The difference between our case is that Over 30 DPD Percentage(P), Over 30 DPD Percentage(S), AND Over 30 DPD Percentage are Measures instead of Columns. Please help if you have a solution.