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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
kirbynguyen
Helper II
Helper II

Multiple Relationships with Many to Many

I am using a identifier table to try to display the values from another table. Here are the tables:

datenamevalue
1-JanRed14
2-JanRed31
3-JanRed43
4-JanRed78
5-JanRed24
1-JanBlue65
2-JanBlue54
3-JanBlue24
4-JanBlue54
5-JanBlue24
1-JanGreen75
2-JanGreen22
3-JanGreen64
4-JanGreen43
5-JanGreen33
1-JanPurple23
2-JanPurple12
3-JanPurple55
4-JanPurple67
5-JanPurple

89

 

namename2name3
RedBluePurple
BluePurpleRed
GreenPurpleRed

 

What I'm trying to display using this example is when I select the first row on the identifier table, I want to display the values for name, name2, and name 3 from the data table. To do this, I have a main relationship (1-many) from ID[name] to Data[name], and also 2 disabled (many-many) relationships for ID[name2] to Data[name] and ID[name3] to Data[name]. I've tried creating DAX to use the relationships for name2 and name3, but it is giving the exact same values for name one.

 

The result I want for the first row (Red, Blue, Purple) is to show the Red, Blue, and Purple lines on 3 separate graphs when I selected the unique [name].

 

How do I solve this?

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Identifier:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bc8xC8MgEIbh/3JzOujdabp2KXQqXcWhELcQSiD/v6nxhK9k8eBB7tWUyF0e74UGepVpP51QHhJ5QHYVGVC4ogDGsaIC+mOnhW7zVvYRFEpNVSDVtG2Q07t6etdq97WU34yYM/YeesYBg8btz/rHzJB8butnrk9haHZ3GO2uCtXuIUK2+3ilnL8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [date = _t, name = _t, value = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type date}, {"name", type text}, {"value", Int64.Type}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"name"}, Reference, {"name"}, "Reference", JoinKind.LeftOuter),
    #"Expanded Reference" = Table.ExpandTableColumn(#"Merged Queries", "Reference", {"name2", "name3"}, {"name2", "name3"})
in
    #"Expanded Reference"

Reference:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCkpNUdJRcsopTQVSAaVFBTmpSrE60WgiOmB1IHH3otTUPAyJWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [name = _t, name2 = _t, name3 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"name", type text}, {"name2", type text}, {"name3", type text}})
in
    #"Changed Type"
How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".

View solution in original post

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

Hi @kirbynguyen ,

 

Whether the advice given by @lbendlin  has solved your confusion, if the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.


Looking forward to your feedback.


Best Regards,
Henry

lbendlin
Super User
Super User

Identifier:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bc8xC8MgEIbh/3JzOujdabp2KXQqXcWhELcQSiD/v6nxhK9k8eBB7tWUyF0e74UGepVpP51QHhJ5QHYVGVC4ogDGsaIC+mOnhW7zVvYRFEpNVSDVtG2Q07t6etdq97WU34yYM/YeesYBg8btz/rHzJB8butnrk9haHZ3GO2uCtXuIUK2+3ilnL8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [date = _t, name = _t, value = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type date}, {"name", type text}, {"value", Int64.Type}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"name"}, Reference, {"name"}, "Reference", JoinKind.LeftOuter),
    #"Expanded Reference" = Table.ExpandTableColumn(#"Merged Queries", "Reference", {"name2", "name3"}, {"name2", "name3"})
in
    #"Expanded Reference"

Reference:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCkpNUdJRcsopTQVSAaVFBTmpSrE60WgiOmB1IHH3otTUPAyJWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [name = _t, name2 = _t, name3 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"name", type text}, {"name2", type text}, {"name3", type text}})
in
    #"Changed Type"
How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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