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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
nigel_s
Frequent Visitor

Link reference table twice without duplicating data.

Given the following tables

 

Trip

ID

FromLocationID

ToLocationID

 

Location

ID

Name

City

 

I want to be able to use the location name for both the From and To in Trip but you can't create two active relationships. I can use Lookup, but if I wanted to reference City and Name, that becomes a pain, I really want to reference the entire table. I can add the Location table twice and link From and To separately but I think this duplicates the data in the Location table. 

Is there a way to include a reference table twice but make the second a virtual copy of the first?

 

What's the best way to do this? In my actual model Location is used multiple times with several fact tables, with multiple location fields.

 

Thanks in advance for your help.

1 REPLY 1
DataInsights
Super User
Super User

@nigel_s,

 

You can create an inactive relationship and use the DAX function USERELATIONSHIP to activate the inactive relationship. In this example, the active relationship would be between Location[ID] and Trip[FromLocationID]. The inactive relationship would be between Location[ID] and Trip[ToLocationID]. Example measure:

 

Count Trip ID - To Location =
CALCULATE (
    COUNT ( Trip[ID] ),
    USERELATIONSHIP ( Location[ID], Trip[ToLocationID] )
)

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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