In cube, We have two fact tables named Goaldata and Actualdata and a Time dimension along with other dimensions. In Goaldata table, we have data till 2016 December and in Actualdata table we have data till 2016 June(current month) and for some products we have data till may 2016 only.
Since Goaldata table has data till December, The time dimension also have an entries till December 2016. For rolling 6 months calculation on Actualdata table, If I use Bottomcount function it’s pulling the data from December 2016 which will be blank value. To avoid that, We used Nonempty function along with bottomcount.
This logic worked well for the data which has values till June 2016. If the data is till May 2016, our logic takes rolling 6 months from May but we want it to take from June 2016 irrespective of whether we have data or not in any of the months. Also, If any of the of the middle months don’t have data then it’s ignoring that month and taking another month value(basically it takes 6 months which has data)
(AVG(BOTTOMCOUNT(NONEMPTY([Time].[Hierarchy].[Year Month].members,[Measures].[Measure name]),6),(([Measures].[Measure name])))
Please do the needful