Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hi Guys,
I'm searching a method to calculate in an additional column the hierarchy on column1 based on the parent relationship reported in column2.
Basically the root level is Leve1 when "location" is reported on Column2.
below a picture that shown what I need
Solved! Go to Solution.
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.
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 ,
you can use this calculated column
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks Mangus but I have to do this in Power Query editor
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
82 | |
81 | |
52 | |
39 | |
35 |
User | Count |
---|---|
95 | |
79 | |
52 | |
49 | |
47 |