I have a line chart which shows avg of product sales. And now the requirement is I need to add multiple aggregations in to the existing line chart. Ie, 2 more lines, one is aggregated at state level and another is aggregated at region level. Existing line is the one with Lowest granularity (Store ) level. So the expectation is whenever we select a particular store, store level line shows the avg value of the metric for the selected store. State level aggregation should shows the aggregated value of the metric for the state in which the store resides . Similarly region level aggregation should show the aggregated value of the region in which the particular store resides.
When all the stores are selected, then all the 3 levels should display same value.
I have done the following calculations to achieve this.
Avg Product Sales (Which is the lowest granularity level) = avg({product_sales})
State Level-LAW = avgOver ( ({product_sales}), [{region_name},{state_name},{application_month_dt},{product_category},{product_sales}],PRE_FILTER )
Region level-LAW = avgOver((product_sales}),[{region_name},{application_month_dt},{product_category},{product_sales}],
PRE_FILTER )
Whenever I select a particular store, Avg product sales should show the avg product sales value of that store and State level should show the avg product sales value of the state in which the store resides and region should show region’s product sales value in which the selected store resides.
But here the issue is whenever I select any store, all the aggregations are changing to show the value of the selected store. Ie, all the lines are appearing as a single line as shown below. But it should not appear like this. It have to appear as 3 different lines.
Can anyone help to solve this issue, if there is anything wrong with the calculation or process I am doing?