Calculating Last 90 day average.
Posted: Mon Nov 18, 2013 2:22 pm
Hello Folks,
I am trying to do a calculation where I have to show the user the last 90 day sales average from each day.
Below is the given output that i am expecting (For easy understanding purpose I have taken total of last 3 days for each day).
"Date", "Sales", " Last 3days Running total", "From-Todate"
1-Jan 100 100 (30dec-1jan)
2-Jan 200 300 31 dec-2jan
3-Jan 100 400 1jan-3jan
4-Jan 50 350 2jan-4jan
5-Jan 20 170 3jan-5jan
6-Jan 15 85 4jan-6jan
7-Jan 20 55 5jan-7jan
8-Jan 30 65 6jan-8jan
9-Jan 100 150 7jan-9jan
10-Jan 20 150 8jan-10jan
I am out of ideas as to how should this be calculated in TM1 it is quite easy to do in SQL query and simply populate the cube, however I do not have one dimension I have around 11 dimensions across which I need to take care of this calculation which should be done at runtime. I have already created a similar kind of a calculation in SSAS cube using MDX query, however not really getting any starting to point to write MDX query for calculating a measure value (perhaps "calculating a measure value using MDX" I dont think it is possible in TM1).
Here is the ssas code that I have used, it may not be useful but, I am not just able to absorb the fact that a thing which is possible in SSAS is not possible in TM1.
Request the TM1 gurus to throw light on this topic.
I am trying to do a calculation where I have to show the user the last 90 day sales average from each day.
Below is the given output that i am expecting (For easy understanding purpose I have taken total of last 3 days for each day).
"Date", "Sales", " Last 3days Running total", "From-Todate"
1-Jan 100 100 (30dec-1jan)
2-Jan 200 300 31 dec-2jan
3-Jan 100 400 1jan-3jan
4-Jan 50 350 2jan-4jan
5-Jan 20 170 3jan-5jan
6-Jan 15 85 4jan-6jan
7-Jan 20 55 5jan-7jan
8-Jan 30 65 6jan-8jan
9-Jan 100 150 7jan-9jan
10-Jan 20 150 8jan-10jan
I am out of ideas as to how should this be calculated in TM1 it is quite easy to do in SQL query and simply populate the cube, however I do not have one dimension I have around 11 dimensions across which I need to take care of this calculation which should be done at runtime. I have already created a similar kind of a calculation in SSAS cube using MDX query, however not really getting any starting to point to write MDX query for calculating a measure value (perhaps "calculating a measure value using MDX" I dont think it is possible in TM1).
Here is the ssas code that I have used, it may not be useful but, I am not just able to absorb the fact that a thing which is possible in SSAS is not possible in TM1.
Code: Select all
Sum(
(
BottomCount(DESCENDANTS([As of Date].[Year - Quarter - Month - Date].CURRENTMEMBER, [As of Date].[Year - Quarter - Month - Date].[Date]),1).item(0).lag(89):
BottomCount(DESCENDANTS([As of Date].[Year - Quarter - Month - Date].CURRENTMEMBER, [As of Date].[Year - Quarter - Month - Date].[Date]),1).item(0)
),
[Measures].[GrossRevenue]
) / 90
Request the TM1 gurus to throw light on this topic.