Calculating a Rolling Average Containing Empty Values
I noticed that whenever a cell is empty, Pyramid excludes it from the average. For example, if week1 = 1, week2 = 0, week3 = 5, Pyramid excludes the week 2 element from the calculation (i.e., (1+5)/2 as opposed to the correct (1+0+5)/3). This makes average calculations - especially rolling average calculations, useless. I would like to include all weeks in the calculation, with weeks of no activity having a value of 0.
Because Pyramid's behavior excludes the week, as opposed to including it and calling it NULL, IfNull logic does not work. Moreover, IsEmpty is not supported. Finally, having a zero "fill blank" functionality was requested but Not Planned.
Any help would be greatly appreciated!
10 replies
-
Hi John,
we already had this problem, too.In the end, it is rather a data model problem: I assume that the data point "week2 = 0" is not part of the data, this particular fact does not exist. Therefore, Pyramid counts only two rows and calculates the average accordingly. Even if you would manage to visualize week2 in the grid (probably via outer joins in the model and via "Show Empties" in the visualization) this week is not available for the calculation.
So - as a solution/workaround: Is it possible to fill up your data with explicit zeros for "empty" weeks?
Best regards,
Michael -
Hi John,
I tried using the week number. Please let me know if that helps.
Example : 2018 week 4 ---> 1641009.35/4=410252.34. we don't have data for some weeks like week 1, 2, 3, 5, 6, ...
Thanks & Regards
Vijayan Krishnan
-
Hi
In some circumstances you can also use the built in "Fill the Blanks" function in Discover.
Here we have Returns by full week with Show Empties on:
Clicking on the Fill the Blanks button in the Ribbon Menu, you can add (or swap in) a new column with the blanks filled in.
An explanation of the action is also inserted into the Notes section of your Discover view.
Hope that helps.
Ian