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

How to create measures for data with many-to-many relationship

Hi everyone,

I have these two tables connected by a key column, with a many-to-many relationship,

I can't change this relationship setting, it is a limitation of my data sources,

With that established, I would like to create a measure to put into a simple Table visual, that sums the value from one table with the other table,


For example, I have this table 1:

ID TABLE 1 DATESHIP
A01/05/2023MAERSK LAMANAI
A02/02/2023CMA CGM RHONE
A03/07/2023SAN VICENTE


And this table 2:

ID TABLE 2PODTT
ATenerife23
ARotterdam28
ALisboa25
ALas Palmas24
ABremerhaven30
AVado Ligure30

 

When I  connect both tables by column ID, I get the following table when I build it using the Table Visual:

DATESHIPPODTT
01/05/2023MAERSK LAMANAITenerife23
01/05/2023MAERSK LAMANAIRotterdam28
01/05/2023MAERSK LAMANAILisboa25
01/05/2023MAERSK LAMANAILas Palmas24
01/05/2023MAERSK LAMANAIBremerhaven30
01/05/2023MAERSK LAMANAIVado Ligure30
02/02/2023CMA CGM RHONETenerife23
02/02/2023CMA CGM RHONERotterdam28
02/02/2023CMA CGM RHONELisboa25
02/02/2023CMA CGM RHONELas Palmas24
02/02/2023CMA CGM RHONEBremerhaven30
02/02/2023CMA CGM RHONEVado Ligure30
03/07/2023SAN VICENTETenerife23
03/07/2023SAN VICENTERotterdam28
03/07/2023SAN VICENTELisboa25
03/07/2023SAN VICENTELas Palmas24
03/07/2023SAN VICENTEBremerhaven30
03/07/2023SAN VICENTEVado Ligure30

 

I would like to create a measure that sums the column TT to the column DATE, getting the expected result:

DATESHIPPODTTRESULT
01/05/2023MAERSK LAMANAITenerife2324/05/2023
01/05/2023MAERSK LAMANAIRotterdam2829/05/2023
01/05/2023MAERSK LAMANAILisboa2526/05/2023
01/05/2023MAERSK LAMANAILas Palmas2425/05/2023
01/05/2023MAERSK LAMANAIBremerhaven3031/05/2023
01/05/2023MAERSK LAMANAIVado Ligure3031/05/2023
02/02/2023CMA CGM RHONETenerife2325/02/2023
02/02/2023CMA CGM RHONERotterdam2802/03/2023
02/02/2023CMA CGM RHONELisboa2527/02/2023
02/02/2023CMA CGM RHONELas Palmas2426/02/2023
02/02/2023CMA CGM RHONEBremerhaven3004/03/2023
02/02/2023CMA CGM RHONEVado Ligure3004/03/2023
03/07/2023SAN VICENTETenerife2326/07/2023
03/07/2023SAN VICENTERotterdam2831/07/2023
03/07/2023SAN VICENTELisboa2528/07/2023
03/07/2023SAN VICENTELas Palmas2427/07/2023
03/07/2023SAN VICENTEBremerhaven3002/08/2023
03/07/2023SAN VICENTEVado Ligure3002/08/2023


I never worked with many-to-many measures, and I'm struggling to get the expected result,

There is a way to solve this question? Thank you!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

I have created a simple sample, please refer to it to see if it helps you.

 

vrongtiepmsft_0-1689559338189.png

Then create a measure.

Measure = MAX(Table1[DATE])+MAX(Table2[TT])

 

vrongtiepmsft_1-1689559356074.png

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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

Hi @Anonymous ,

I have created a simple sample, please refer to it to see if it helps you.

 

vrongtiepmsft_0-1689559338189.png

Then create a measure.

Measure = MAX(Table1[DATE])+MAX(Table2[TT])

 

vrongtiepmsft_1-1689559356074.png

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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

 

 

gregoliveira
Helper II
Helper II

Hi.

I do not use many to many relationships as well, but if I need to use, my first shot will be read the SQLBI articles (https://www.sqlbi.com/topics/many-to-many/ and https://www.sqlbi.com/articles/different-options-to-model-many-to-many-relationships-in-power-bi-and...).
Hope one of them can help you.

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.