Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

hierarchic database and recursive data display in powerBI

Hi!

So I'm currently working on some powerBI stuff, and I have a database table which is hierarchic, meaning I have something like this:

__id___Place______id_parent

  1. London_____null
  2. Paris________null
  3. Madrid_____null
  4. MyInc_________1
  5. Building1_____4
  6. Building2_____4
  7. Floor1________5
  8. Floor2________5

Equivalent to something like that:

  • London
    • MyInc
      • Building1
        • Floor1
        • Floor2
      • Building2
  • Paris
  • Madrid

 

I've found out I can use PATH() that gives me a list of id's from parent to my selected node, but how to go from (7, 5, 4, 1) to "Floor1 => Building1 => MyInc => London" string?

 

Thanks by advance for your support

2 REPLIES 2
v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

Do you want to achieve a string-like purpose through the path() function? For example, the following test I did. If you misunderstand what you mean, can you further clarify your needs, provide accurate test data and expected results, I will answer you as soon as possible.

Column = PATH('Table'[Employee],'Table'[ReportingTo])

vhenrykmstf_0-1624860936942.png

 

You can also refer to related blogs:

How to Retrieve Data Recursively with Power BI

Recursive Functions in Power BI / Power Query — Powered Solutions


Looking forward to your reply.

Best Regards,
Henry

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi!

In my first atempt I was using the ids of the lines and was getting "1|2|6" and was trying to figure out how to make it look like what you've shown... but I can just make a new column with name depending on id, and then use it as recursive PATH!

Thanks a lot!

 

now is there a way to take that CEO|VP|AVP and make it look like "CEO -> VP -> AVP" ? it would be perfect!

that would totally fit my need!

 

Thanks again for your help

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.