Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all,
I have calculated the 06 month moving average by using following expression starting from Jan'2013.
RANGEAVG(ABOVE(RANGESUM(PREMIUM),0,6))
But the results are not in order since Jan'2014 , may be due to year change. Please any one can help me urgently.
Results of the same table is as follows.
BCOD | STATUS | ME_CODE | YEAR | MONTH | PREMIUM | MOV_AVG |
B100 | EX | -32,790 | -32,790 | |||
B100 | 1 | DIR D | 2013 | Jan | 49,819 | 49,819 |
B100 | 1 | DIR D | 2013 | Feb | 43,481 | 46,650 |
B100 | 1 | DIR D | 2013 | Mar | 43,160 | 45,487 |
B100 | 1 | DIR D | 2013 | Apr | 61,720 | 49,545 |
B100 | 1 | DIR D | 2013 | May | 92,939 | 58,224 |
B100 | 1 | DIR D | 2013 | Jun | 39,873 | 55,166 |
B100 | 1 | DIR D | 2013 | Jul | 79,645 | 60,136 |
B100 | 1 | DIR D | 2013 | Aug | 77,566 | 65,817 |
B100 | 1 | DIR D | 2013 | Sep | 52,516 | 67,377 |
B100 | 1 | DIR D | 2013 | Oct | 172,026 | 85,761 |
B100 | 1 | DIR D | 2013 | Nov | 54,610 | 79,373 |
B100 | 1 | DIR D | 2013 | Dec | 89,752 | 87,686 |
B100 | 1 | DIR D | 2014 | Jan | 104,598 | 104,598 |
B100 | 1 | DIR D | 2014 | Feb | 114,533 | 109,566 |
B100 | 1 | DIR D | 2014 | Mar | 137,232 | 118,788 |
B100 | 1 | DIR D | 2014 | Apr | 105,700 | 115,516 |
B100 | 1 | DIR D | 2014 | May | 84,865 | 109,386 |
Priyantha.
Yes, when you want to cross dimension borders you need to add the TOTAL keyword
RANGEAVG(ABOVE(TOTAL RANGESUM(PREMIUM),0,6))
Dear Gysbert,
by adding total keyword whole dimension borders are crossing. Just i want to cross only the Year border
Priyantha.
That's not possible. You'll have to use another approach. See this document: Calculating rolling n-period totals, averages or other aggregations
Thanks........Gybert,