Data aggregation issues for different hierarchical levels
Hi, I am having a hard time dealing with different hierarchical levels within a dataset, if anyone could point me to a solution, I would appreciate.
My dataset (see table bellow) contains scores for variables aggregated in 3 different levels, for one country. Each level 3 variable has a different weight, as indicated on the weight column.
I want to create a graph that will allow me to explore the 3 different levels with the drill down capability. However, my attempts always ended with the wrong data aggregation (ie. PowerBI not taking into account the need to rebalance the weights when moving from one level to another).
To illustrate my issue, an example of what the correct data aggregation would be: if I want to see the score for variable A for country XX, a simple sumproduct (Score*Weight), with the interval of lines 2 to 5 would do the trick. The corresponding score will be 3,10. For variable AB, PowerBI needs to rebalance the weights so that the three corresponding weights (lines 2, 3 and 4) add up to 1, and the correct score would be 2,85. For variable ABA, PowerBI would need to rebalance the two weights (lines 2 and 3) so that they would add to 1 and calculate the corresponding score, which would be 2,27.
Let me show you an example of what I am trying to replicate in PowerBI: I want to be able to calculate the weighted score for each variable, given the 3 different levels. For example, the weighted score for variable A (Level 1) will be a simple sumproduct (0,2*1+0,35*3+0,4*4+0,05*5). Now, for variable AB (Level 2), I have to rebalance the weights because they won't add up to 1 (0,2 + 0,35 + 0,4). Once I rebalance the weights, I can do a sumproduct between the 3 new rebalanced weights and the corresponding score, which would be (0,21*1+ 0,37*3 + 0,42*4), giving me a result of 2,85. For a level 3 variable, let's say variable ABA, I would also have to rebalance the weights so they add up to 1 in order to do a sumproduct (0,36*1 + 0,64*3), giving me a result of 2,27.
Please let me know if these examples are not clear.
Thank you for clarifying. Can you please also share the exact result you want. Don't share visual for now. Just share the expected result in a Table format and let me know what selections in the slicer/filter will you be making.
Please find bellow a table with the expected results. I changed the table so that the levels are now a column. As for the slicers and filters, the only one would be the country column. As for the variables and the levels, my intention is to use the drill down capability to show, initially, only variables from the level 1 and once the user clicks on a varible, it would show the corresponding variables on level 2.