Forum Discussion

chat_peters's avatar
chat_peters
Helper III
4 years ago
Solved

Userelationship measure and count rows

Hello, I have a question about userelationship function, I've been tasked with having one filter respond to two different columns in the same table 😞  Link to sample file:  https://www.dropbox.com/s/8is8eo29lot8q8i/example.pbix?dl=0
I have four tables in my model. Orderfact, CallerDim, BuyerDim and People Dim. The ask is to be able to pick a location from people fact and have it respond to both columns in order fact. For example say if
order ID 1 - Caller is from Lima and the Buyer is from Guadalajara
order ID 2 - the Caller is from Guadalajara and the buyer is from Leon
Order ID 3 - Caller and Buyer are both from Guadalajara. When I choose Guadalajara from the location filter it should be able to pick up all three of the records.

 

Currently I can achieve this by creating a measure with userelationship

 

inactiverelationshipmeasure = CALCULATE('Order Fact'[Total Orders],USERELATIONSHIP('Order Fact'[BuyerID],'PeopleDim'[Id]))

 

However, in order for the filter to respond to both columns in the same table, I need to drag this measure and Total Orders measure

 

Total Orders = COUNT('Order Fact'[Order ID])

 

I created two columns using look up to get caller location and buyer location into the fact table. I need to create a measure or a flag so that my visual doesn't look confusing. For example the total number of rows with the location filter set to Guadalajara in the visual in the picture should be 14, how do I achieve that? Can you please help me?

6 Replies