Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Parent-child hierarchy

Hello PBI Forum!   A month ago i needed a help with parent-child hierarchy, the solutions really worked but now I need to do a little diff...   My goal at that time was to create 4 new hierarchy ...
  • mangaus1111's avatar
    3 years ago

    hi Anonymous ,

    you can add this to the original query

    #"Added Custom4" = Table.AddColumn(#"Removed Columns", "Level 2.1", each if [Level 2] = [Level 1] then null else [Level 2]),
        #"Added Custom5" = Table.AddColumn(#"Added Custom4", "Level 3.1", each if [Level 3] = [Level 2] or [Level 3] = [Level 1] then null else [Level 3]),
        #"Added Custom6" = Table.AddColumn(#"Added Custom5", "Level 4.1", each if [Level 4] = [Level 3] or [Level 4] = [Level 2] or [Level 4] = [Level 1] then null else [Level 4]),
        #"Removed Columns1" = Table.RemoveColumns(#"Added Custom6",{"Level 2", "Level 3", "Level 4"}),
        #"Renamed Columns" = Table.RenameColumns(#"Removed Columns1",{{"Level 2.1", "Level 2"}, {"Level 3.1", "Level 3"}, {"Level 4.1", "Level 4"}})
    in
        #"Renamed Columns"