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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
Anonymous
Not applicable

Use multiple relationships in a measure

Hello Everyone!

 

I've been at this for a while now and have been researching to no avail!

 

I have two tables with 3 columns that need to be joined (Date, Code and Company]. The desired outcome would be for the MM Measure (file here) to filter using the same date slicer under the correct Company and Code - so far it's returning grand totals.

 

So far I have one active relationship and two inactive ones. The measure looks like this:

MM Measure = CALCULATE(SUM(Sheet2[MM Count]),
                        USERELATIONSHIP(Sheet1[Code],Sheet2[Code]),
                        USERELATIONSHIP(Sheet1[Company],Sheet2[company_id]),
                        USERELATIONSHIP(Sheet1[Date],Sheet2[date])
)                    

This does not seem to work.

 

The SQL equivilent would be something like this:

SELECT sheet1.company, 
       sheet1.code, 
       sheet1.date, 
       sheet1.adjdate, 
       sheet1.net, 
       sheet1.count, 
       sheet2.[mm count] 
FROM   sheet1 
       LEFT OUTER JOIN sheet2 
                    ON 1 = 1 
                       AND sheet1.company = sheet2.company_id 
                       AND sheet1.code = sheet2.code 
                       AND sheet1.adjdate = sheet2.date 

 

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi, @Anonymous 

For your case, you to refer to this way:

 Create a combined value column for each table, then use them to create a relationship.

for example:

for sheet1 table

combined = Sheet1[Company]&Sheet1[Code]&Sheet1[Date]

for sheet2 table

combined = Sheet2[company_id]&Sheet2[Code]&Sheet2[date]

Then create a relationship as below

3.JPG

https://community.powerbi.com/t5/Desktop/Cannot-create-multiples-column-relationship-between-two-tables/td-p/48261

 

 

 

Best Regards,

Lin

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Worked like a charm! thank you

v-lili6-msft
Community Support
Community Support

hi, @Anonymous 

For your case, you to refer to this way:

 Create a combined value column for each table, then use them to create a relationship.

for example:

for sheet1 table

combined = Sheet1[Company]&Sheet1[Code]&Sheet1[Date]

for sheet2 table

combined = Sheet2[company_id]&Sheet2[Code]&Sheet2[date]

Then create a relationship as below

3.JPG

https://community.powerbi.com/t5/Desktop/Cannot-create-multiples-column-relationship-between-two-tables/td-p/48261

 

 

 

Best Regards,

Lin

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

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

May 2025 Monthly Update

Fabric Community Update - May 2025

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