Forum Discussion
power query hierarchy's calculation
- 3 years ago
it works only in this case, when the values don't change. Otherwise I need to update code every time.
I'm found a solution using Merge funciton applied on the same table.in the result it's necessary to select "lev 1", that can be renamed in "lev 2", then filter "lev 0" = "location"
this is the result
Hi montibellin ,
try this
= Table.AddColumn(#"Changed Type", "Custom", each if [Parent] = "Location" then "Level 1" else if [Parent] = "Europe" or [Parent] = "Africa" or [Parent] = "Oceania" or [Parent] = "Asia" or [Parent] = "America" then "Level 2" else "Level 3")
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- montibellin3 years ago
Helper I
it works only in this case, when the values don't change. Otherwise I need to update code every time.
I'm found a solution using Merge funciton applied on the same table.in the result it's necessary to select "lev 1", that can be renamed in "lev 2", then filter "lev 0" = "location"
this is the result