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
Anonymous
Not applicable

Multiply two tables with a many to many relationship

I want to multiply Split by the Volume on the match of Hopital and Pathway. The added issue I have aswell is the both tables are a many to many relationship on Hospital and Pathway, which I can resolve by creating reference tables and joining both tables to them.

I get results with 

Volume Split by Overnight = SUM(Activity[Volume])*SUM(Hospital[Split])

But I get the incorrect total.

 

Here is the tables;

Table and Results

 

 

Relationships to resolve many to many;

 

Relationship

 

Thank you in advance!

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

Based on your steps, please create the measure below to achieve your desired output.

 

Measure =
VAR _table =
    FILTER (
        GENERATE ( Activity, Hostipal ),
        Activity[Hospital] = Hostipal[Hospital]
            && Activity[Pathway] = Hostipal[Pathway]
    )
RETURN
    SUMX ( _table, [Volume Split by Overnight] )

Here is the output.

 

Capture.PNG

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
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
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

Based on your steps, please create the measure below to achieve your desired output.

 

Measure =
VAR _table =
    FILTER (
        GENERATE ( Activity, Hostipal ),
        Activity[Hospital] = Hostipal[Hospital]
            && Activity[Pathway] = Hostipal[Pathway]
    )
RETURN
    SUMX ( _table, [Volume Split by Overnight] )

Here is the output.

 

Capture.PNG

 

Best  Regards,

Cherry

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

Dear Cherry

 

I have a very similar problem like JayZee64.

Many-to-Many-Relationship

 

Applying your solution I noted that it took a bit of time to calculate the measure with a mid-sized table.

Does the below method also work well with large tables?

Are there alternative options you would recommend besides the _table on the fly?

 

Many thanks in advance

F.

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.