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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Borja204
Helper II
Helper II

Join and expand 2 tables

Hi! 

 

I'm kinda new to power query and I am struggling with something that maybe simple:

 

Giving this 2 tables:

 

UsersPermissions

User1005
User2010

 

PermisionsTablePath

005005
010005|010
020005|010|020

 

I'd need to obtain this table in power query:

 

User1005
User1010
User1020
User2010
User2020

 

How could I achieve this?

 

Thanks!

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

Based on the limited sample dataset,

let
    PermissionPath = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjAwVdIBk7E6QJ6hAYRXA2KBRYyQRGpAvNhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Permission = _t, Path = _t]),
    #"Sorted Rows" = Table.Sort(PermissionPath,{{"Path", Order.Ascending}}),
    #"Transformed Path" = Table.TransformColumns(Table.RemoveColumns(#"Sorted Rows",{"Permission"}), {"Path", each Text.Split(_, "|")}),
    UserPermission = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCi1OLTJU0lEyMDBVitWB8I1AfEMDpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [User = _t, Permission = _t]),
    #"Selected Path" = Table.TransformColumns(UserPermission, {"Permission", each let l=List.Last(List.Select(#"Transformed Path"[Path], (l) => List.Contains(l,_))), pos=List.PositionOf(l, _) in try List.RemoveRange(l, pos-1) otherwise l}),
    #"Expanded Permission" = Table.ExpandListColumn(#"Selected Path", "Permission")
in
    #"Expanded Permission"

Screenshot 2021-05-16 233351.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

2 REPLIES 2
Borja204
Helper II
Helper II

Thanks!!!

CNENFRNL
Community Champion
Community Champion

Based on the limited sample dataset,

let
    PermissionPath = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjAwVdIBk7E6QJ6hAYRXA2KBRYyQRGpAvNhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Permission = _t, Path = _t]),
    #"Sorted Rows" = Table.Sort(PermissionPath,{{"Path", Order.Ascending}}),
    #"Transformed Path" = Table.TransformColumns(Table.RemoveColumns(#"Sorted Rows",{"Permission"}), {"Path", each Text.Split(_, "|")}),
    UserPermission = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCi1OLTJU0lEyMDBVitWB8I1AfEMDpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [User = _t, Permission = _t]),
    #"Selected Path" = Table.TransformColumns(UserPermission, {"Permission", each let l=List.Last(List.Select(#"Transformed Path"[Path], (l) => List.Contains(l,_))), pos=List.PositionOf(l, _) in try List.RemoveRange(l, pos-1) otherwise l}),
    #"Expanded Permission" = Table.ExpandListColumn(#"Selected Path", "Permission")
in
    #"Expanded Permission"

Screenshot 2021-05-16 233351.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.