I have a requirement where i need a solution slightly different from '" Hierarchies In Power BI Visualizations - Problem Of The Week " , to find the find the parent and child relation for all the components . Hierarchy Problem 2.xlsx (20.9 KB)
Made a start here but I’m running out of day.
Maybe you could take the principles and finish off.
Logic centres around all continents and sub continents being in spelt with capital letters (Text.Upper) and all cities being spelt as Text.Proper, ie initial capital letters.
The attached gets close but the power query fill is filling the proper spelt words incorrectly.
You probably just need to do some more column concatenation to recreate lvl3 onwards so that countries all in one col and cities all in another. then don’t fill the cities
I think personally this is a bit messy, especially if table expands and the spelling convention is breached.
There will be other M gurus out there with a better approach I’m sure. Hierarchy Problem 2 (1).xlsx (33.6 KB)
Sorry not to have given a better solution
Cheers
Pete
I believe this community is really lucky to have amazing experts like @Melissa , my mission is to figure out how this code works thanks a lot once again