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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Nepal101
Helper III
Helper III

Working with Many to Many doesn't give me correct value.

Hello Everyone, 
I was trying to create a table by merging two different tables in one but I am getting duplicate rows for dates. I tried to create a bridge table instead of merging the two tables then there was an error saying Can't determine the relationship between fields. 
Merging the two tables below is an issue where the date gets duplicated. 

Nepal101_0-1713846801334.png
when I tried to create the bridge table 

Nepal101_1-1713846975739.png

but then I got an error saying 

Nepal101_2-1713847015291.png
Please help if there is any solution or workaround for solving this issue. 
Thank you for your time. 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Nepal101 ,

 

Thanks @Ritaf1983  for the quick reply. I have some additional suggestions:

(1)Add a column to Table 1.

rank = RANKX(FILTER('Table (1)',[Client name ]=EARLIER('Table (1)'[Client name ]) ),[Communicationdate ],,ASC,Dense)

(2)Add a column to Table 2.

rank = RANKX(FILTER('Table (2)',[client name ]=EARLIER('Table (2)'[client name ])),[Sample provided date],,ASC,Dense)

(3)We can create a table.

NewTable =
SELECTCOLUMNS (
    ADDCOLUMNS (
        'Table (1)',
        "s_date",
            CALCULATE (
                MAX ( 'Table (2)'[Sample provided date] ),
                FILTER (
                    'Table (2)',
                    [Client name ] = EARLIER ( 'Table (1)'[Client name ] )
                        && [code] = EARLIER ( 'Table (1)'[code] )
                        && [rank] = EARLIER ( 'Table (1)'[rank] )
                )
            )
    ),
    "Client name", [Client name ],
    "Communicationdate", [Communicationdate ],
    "Sample Provided date", [s_date]
)

vtangjiemsft_0-1714111524707.png

 

Best Regards,

Neeko Tang

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

3 REPLIES 3
Anonymous
Not applicable

Hi @Nepal101 ,

 

Thanks @Ritaf1983  for the quick reply. I have some additional suggestions:

(1)Add a column to Table 1.

rank = RANKX(FILTER('Table (1)',[Client name ]=EARLIER('Table (1)'[Client name ]) ),[Communicationdate ],,ASC,Dense)

(2)Add a column to Table 2.

rank = RANKX(FILTER('Table (2)',[client name ]=EARLIER('Table (2)'[client name ])),[Sample provided date],,ASC,Dense)

(3)We can create a table.

NewTable =
SELECTCOLUMNS (
    ADDCOLUMNS (
        'Table (1)',
        "s_date",
            CALCULATE (
                MAX ( 'Table (2)'[Sample provided date] ),
                FILTER (
                    'Table (2)',
                    [Client name ] = EARLIER ( 'Table (1)'[Client name ] )
                        && [code] = EARLIER ( 'Table (1)'[code] )
                        && [rank] = EARLIER ( 'Table (1)'[rank] )
                )
            )
    ),
    "Client name", [Client name ],
    "Communicationdate", [Communicationdate ],
    "Sample Provided date", [s_date]
)

vtangjiemsft_0-1714111524707.png

 

Best Regards,

Neeko Tang

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

Nepal101
Helper III
Helper III

 

Hello @Ritaf1983 Thank you for the suggestion, Below is the sample data where each data is coming from a different database. 

 

Client name Communicationdate code
Automotivenull4018
Automotive3/19/20244018
Automotive4/15/20244018

 

client name Sample provided dateEmpcode
Automotive1/5/20234018
Automotive3/25/20244018

Automotive

4/16/20244018

The result that I need is shown below, The above two tables have many to many relationships. I tried to merge the table and it gave me a duplicate date(on the screenshot) for each row. so I was thinking of creating a bridge table that also gave me an error (in the above screenshot) Can you please help me with any suggestion.

Client nameCommunicationdateSample Provided date 
Automotivenull1/5/2023 
Automotive3/19/20243/25/2024 
Automotive4/15/20244/16/2024 
Ritaf1983
Super User
Super User

Hi @Nepal101 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors