Forum Discussion

vinothkumar1990's avatar
2 years ago

Hierarchy output

Hi All,

I came across some below hierarchical requirment. I have two columns called COL1 and COL2 and want to derive the value (MAP). 

COL1 and COL2 have 4 type of relationships i.e. 1:1, 1:M, M:1, M:M.

 

Explanation - For example

Explanation - For example

1. XX1 is mapped to A1 (temp result XX1 : A1)
2. A1 is mapped to XX3 (temp result XX1, XX3 : A1)

3. A1 is mapped to XX3 (temp result XX1, XX3 : A1)

4. XX3 is mapped to A8 (temp result XX1, XX3 : A1, A8)

5. A8 is mapped to XX9 (temp result XX1, XX3, XX9 : A1, A8)

 

 

Is there anyway to achive?

InputInputOutput
COL1COL2MapType
XX1A1XX1,XX3,XX9 : A1,A8M:1
XX2A2XX2,XX4 : A2M:1
XX3A1XX1,XX3,XX9 : A1,A8M:1
XX4A2XX2,XX4 : A2M:1
XX5A3XX5:A31:1
XX6A4XX5:A4,A51:M
XX6A5XX5:A4,A51:M
XX7A6XX7,XX8:A6:A7M:M
XX7A7XX7,XX8:A6:A7M:M
XX8A6XX7,XX8:A6:A7M:M
XX8A7XX7,XX8:A6:A7M:M
XX3A8XX1,XX3,XX9 : A1,A8M:M
XX9A8XX1,XX3,XX9 : A1,A8M:M

3 Replies

  • Daniel29195's avatar
    Daniel29195
    Icon for Community Champion rankCommunity Champion

    vinothkumar1990 

     

    im not sure if this would help  : 

    go to power query ,

    use the split by column feature : 

     

     

     

     

     

    you will have the following :

     

     

     

     

     

     

     

     

    Again -->  split by columns -->  by delimiter -->  

     

     

     

     

     

     

    you will have the bfollowing : 

     

     

     

     

     

     

    last step : 

    select Map-2 column, --> split by columns -->  by delimiter -->  

     

     

     

     

     

     

    final result : 

     

     

     

     

    if this is not what you are looking for , please share an example of the output you want . 

     

     

     

    If my answer helped sort things out for you, i would appreciate a thumbs up πŸ‘ and mark it as the solution βœ…
    It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🀠

     

    • vinothkumar1990's avatar
      vinothkumar1990
      Icon for Helper II rankHelper II

      Daniel29195 - COL1 and COL2 are the data present in input file where as "Map" is the output which i need to derive using COL1 and COL2.

       

      Explanation - For example

      1. XX1 is mapped to A1 (temp result XX1 : A1)
      2. A1 is mapped to XX3 (temp result XX1, XX3 : A1)

      3. A1 is mapped to XX3 (temp result XX1, XX3 : A1)

      4. XX3 is mapped to A8 (temp result XX1, XX3 : A1, A8)

      5. A8 is mapped to XX9 (temp result XX1, XX3, XX9 : A1, A8)

       

  • What you describe sounds more like a network graph than a hierarchy. Hierarchies by definition must be 1:M  (ok, with a corner case of 1:1).