Hi,
I am trying to calculate a weighted time average. My requirements are simple:
QuarterlyAVG = Sum of all months in the quarter / Quarter Weights
HalfYearAVG = Sum of all quarters in HY / HY Weights
FullYearAVG = Sum of half-years in FY / FY Weights
… and so on.
I initially attempted to achieve this using a single formula with the ConsolidateChildren and ConsolidatedAVG functions. However, this approach did not work as expected, as ConsolidatedAVG calculates the average based on all leaf-level elements rather than their immediate children.
My current approach is as follows:
My primary measure element is 'Quantity'. To support the weighted average calculation, I created two additional elements: 'Weight' and 'Quantity Supporting'.
I have implemented the necessary rules and feeders to perform the calculations,
SKIPCHECK;
['Weight'] = IF(ELLEV('Month',!Month)>0,
ConsolidateChildren('Month'),
ABS(SIGN(['Quantity'])));
['Quantity Supporting']=N:['Quantity'];
['Quantity']= C:IF(ELLEV('Month',!Month)>0,
['Quantity Supporting']\['Weight'],
CONTINUE);
FEEDERS;
['Quantity']=>['Weight'];
['Quantity']=>['Quantity Supporting'];
and the screenshot below shows the final results.
Challenges with this approach are it introduces unnecessary data duplication, supporting calculations make it highly inefficient and for each measure requiring an average calculation, I need to create two additional elements, which adds complexity to maintenance.
One improvement could be to make 'Quantity Supporting' a parent of 'Quantity' and reduce some feeder and rule, but I am looking for a more efficient and optimized approach to achieve this calculation without redundancy.
If anyone has a better solution or alternative method, I would appreciate your insights.
Thanks!
Regards,
Jitesh
------------------------------
Jitesh Parmar
------------------------------