Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

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 

 

2 Replies