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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
esulyma
Frequent Visitor

Help with USERELATIONSHIP and Many to Many

Hello Fabric Community,

 

I'm trying to solve this DAX/Model problem, here's the scenario.

 

I have a dimension table with an event called "original sailing key" and "mapped saling key", the problem I have is the "mapped" key has duplicate values so my inactive relationship is a many-to-many type.

 

Measure:

Revenue (Mapped) =
CALCULATE([Revenue],
        USERELATIONSHIP('Passenger'[Ship Sddt], Sailings[Mapped Sailing Key])
)

 

This is causing my measure "Revenue (Mapped)" to work incorrectly with the duplicate values.

 

esulyma_0-1715201718167.png

 

How can I adjust my measure to work around the duplicate values and bringing in the right revenue amount?

 

Data model:

esulyma_1-1715201943853.png

 

2 REPLIES 2
v-jiewu-msft
Community Support
Community Support

Hi @esulyma ,

Based on the description, try to create a bridge table and the table stores the unique sailing key.

Then, create the relationship between the bridge table and passenger table, sailings table.

What’s more, try to modify the measure to the following dax formula.

Revenue (Mapped) =
CALCULATE(
    [Revenue],
    USERELATIONSHIP('BridgeTable'[Sailing Key], 'Sailings'[Mapped Sailing Key])
)

You can also view the following documents to learn more information.

USERELATIONSHIP function (DAX) - DAX | Microsoft Learn

Many-to-many relationship guidance - Power BI | Microsoft Learn

 

Best Regards,

Wisdom Wu

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

Hello! Thanks for your reply, I tried this before without any sucess.

 

I gave it another shot with your guidance, below are the changes I made where it shows the unexpected results.

 

Data model:

esulyma_0-1715259053364.png

 

Visual view where the Revenue (Mapped) measure doesn't show the expected value for mapped (starting in $9):

esulyma_1-1715259098297.png

 

Am I doing something wrong?

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.