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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
fcarvalho
Advocate I
Advocate I

Get all Child record from all levels

Hi,

 

I'm trying to create a Table to be used as RLS. The idea is to use my existing Parent and Id columns from Table A.

 

Table A

 

UserParentemailParentuserIdParentSubIdSub
User1email1@mail.mail1User11
User1email1@mail.mail1User1010
User1email1@mail.mail1User1111
User1email1@mail.mail1User1212
User1email1@mail.mail1User1313
User1email1@mail.mail1User1414
User1email1@mail.mail1User1515
User2email2@mail.mail2User11
User2email2@mail.mail2User22
User3email3@mail.mail3User11
User3email3@mail.mail3User33
User4email4@mail.mail4User11
User4email4@mail.mail4User44

 

What I expect is getting from Parent, all child from all levels, not only from level below, but all levels below (my table have a lot of levels, its not fixed, because levels can be added or removed).

 

Level 1 -> Get all Child users (Level 2,3,4,5,6..)

Level 2 -> All users from Level below (Level 3,4,5,6..)

Level 3 -> All users from Level below (Level 4,5,6..)

(....)

 

Like this table:

 

All of the "Sub" column that are in bold are the ones I want to get in the new table:

 

UserParentemailParentuserIdParentSubIdSub
User1email1@mail.mail1User11
User1email1@mail.mail1User1010
User1email1@mail.mail1User1111
User1email1@mail.mail1User1212
User1email1@mail.mail1User1313
User1email1@mail.mail1User1414
User1email1@mail.mail1User1515
User2email2@mail.mail2User11
User2email2@mail.mail2User22
User2email2@mail.mail2User1010
User2email2@mail.mail2User1111
User2email2@mail.mail2User1212
User2email2@mail.mail2User1313
User2email2@mail.mail2User1414
User2email2@mail.mail2User1515
User3email3@mail.mail3User11
User3email3@mail.mail3User33
User3email3@mail.mail3User22
User3email3@mail.mail3User1010
User3email3@mail.mail3User1111
User3email3@mail.mail3User1212
User3email3@mail.mail3User1313
User3email3@mail.mail3User1414
User3email3@mail.mail3User1515
User4email4@mail.mail4User11
User4email4@mail.mail4User44
User4email4@mail.mail4User22
User4email4@mail.mail4User1010
User4email4@mail.mail4User1111
User4email4@mail.mail4User1212
User4email4@mail.mail4User1313
User4email4@mail.mail4User1414
User4email4@mail.mail4User1515
2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@fcarvalho , Have you already explored this blog?

https://www.blue-granite.com/blog/using-dynamic-row-level-security-with-organizational-hierarchies

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

fcarvalho
Advocate I
Advocate I

3 REPLIES 3
fcarvalho
Advocate I
Advocate I

@amitchandak ,

 

https://www.thebiccountant.com/2017/02/14/dynamically-flatten-parent-child-hierarchies-in-dax-and-po...

 

I think I achieved what I wanted, I'll do some tests and then close the post

amitchandak
Super User
Super User

@fcarvalho , Have you already explored this blog?

https://www.blue-granite.com/blog/using-dynamic-row-level-security-with-organizational-hierarchies

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak ,

 

It is a very good article, but it does not fit my case, because in my data set, a child level sometimes has 2 different parentId or more and I get the error that some value has multiple values.

Another situation is to have to add 1 column per level manually. If there is an alternative, I would appreciate it.

 

Regards,

Thank you

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.