Forum Discussion

Donerandparmo1's avatar
1 month ago
Solved

Creating Hierarchy "Backwards"

Hi All,

 

I have activities which are classed in a WBS hierarchy, but, the hierarchy starts the opposite way to desired, and activities have a differing number of WBS levels, some have 2, others have 9, as such:

Activitywbs9wbs8wbs7wbs6wbs5wbs4wbs3wbs2wbs1
1987654321
2987654321
3  7654321
4       21
5     4321
6    54321
7     4321
8  7654321
9 87654321
10987654321

 

This is the desired output:

Activitywbs1wbs2wbs3wbs4wbs5wbs6wbs7wbs8wbs9
1123456789
2123456789
31234567  
412       
51234     
612345    
71234     
81234567  
912345678 
1012345678

9

 

I have the initial table ready within PowerQuery, with thousands of rows.

 

Thanks for your help!

  • Hi,

     

    I've solved it myself.

     

    I simply replacead all NULL values with a "$", then concatenated all the columns (with £ delimiters), starting with the furthest right column from the initial table.

     

    From there I replaced the $ with blank and split the column via the £ delimiter, and voilá, that was my hierarchy.

4 Replies

  • Rupa01's avatar
    Rupa01
    Solution Sage

    Hi Donerandparmo1,

    If you want to create a hierarchy with columns starting wbs1 to wbs9, then right click on wbs1 column and select "Create hierarchy" and then keep adding columns upto wbs9 to the hierarchy inthe order as required. You can now use the newly created hierarchy in the visual directly.

    Result - 

     

    If this is not the desired result, provide more detailed sample data of the tables for sharing better approach.

     

    💡 Helpful? Give a Kudos 👍 — keep the community growing
     Solved your issue? Mark as Solution ✔️ — help others find it faster

    Best regards,
    Rupasree Achari | BI & Fabric Analytics Engineer  
    • Donerandparmo1's avatar
      Donerandparmo1
      Helper I

      Hi,

       

      Thanks for the response.

       

      This would not work as some activities go up to 9, and others to 2.

       

      I need WBS1 to be the value from the furthest right column on the initial table, with a value, and then WBS2 to be the second furthest right column from that table, with a value.


      Does that make sense?

       

      Cheers.

      • Rupa01's avatar
        Rupa01
        Solution Sage

        Donerandparmo1 

        Based on the comments, the table visual should have below desired result - 

        Option1 - Create a hierarchy starting from WBS9 up till WBS1

         

        Option2 - If you want to show the hierarchy dynamically from WBS9 to WBS1 based on the activities as some go upto 9 while others upto 2 - The solution is to have a Field Parameter created from WBS9 to 1 which will have slicer to choose.

        Parameter = {
            ("wbs9", NAMEOF('Table'[wbs9]), 0),
            ("wbs8", NAMEOF('Table'[wbs8]), 1),
            ("wbs7", NAMEOF('Table'[wbs7]), 2),
            ("wbs6", NAMEOF('Table'[wbs6]), 3),
            ("wbs5", NAMEOF('Table'[wbs5]), 4),
            ("wbs4", NAMEOF('Table'[wbs4]), 5),
            ("wbs3", NAMEOF('Table'[wbs3]), 6),
            ("wbs2", NAMEOF('Table'[wbs2]), 7),
            ("wbs1", NAMEOF('Table'[wbs1]), 8)
        }

        If this is not the expectation, please share sample data in a pbix file and exact snapshots of expected results by case for sharing better solution.

         

        💡 Helpful? Give a Kudos 👍 — keep the community growing
         Solved your issue? Mark as Solution ✔️ — help others find it faster

        Best regards,
        Rupasree Achari | BI & Fabric Analytics Engineer   

         

  • Hi,

     

    I've solved it myself.

     

    I simply replacead all NULL values with a "$", then concatenated all the columns (with £ delimiters), starting with the furthest right column from the initial table.

     

    From there I replaced the $ with blank and split the column via the £ delimiter, and voilá, that was my hierarchy.