Forum Discussion
Working with Many to Many doesn't give me correct value.
- Anonymous2 years ago
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] )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.
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 |
| Automotive | null | 4018 |
| Automotive | 3/19/2024 | 4018 |
| Automotive | 4/15/2024 | 4018 |
| client name | Sample provided date | Empcode |
| Automotive | 1/5/2023 | 4018 |
| Automotive | 3/25/2024 | 4018 |
Automotive | 4/16/2024 | 4018 |
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 name | Communicationdate | Sample Provided date | |
| Automotive | null | 1/5/2023 | |
| Automotive | 3/19/2024 | 3/25/2024 | |
| Automotive | 4/15/2024 | 4/16/2024 |