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
TomMartiG
Regular Visitor

Many to Many relation problem

Hi, I need to make a report with the sales of each sales rep per customer together with its credit and net sales. I have two tables that looks like this 

Sales repCustomerCreditDate
JohnA10Yesterday
MaxA20Today

 

Sales repCustomerAmount
JohnA30
MaxA40

 

and I want a table that looks like this 

 

Sales repCustomerCreditAmountDate
JohnA1030Yesterday
MaxA2040Today

 

I already created a many to many relation, but when  I use the table visulaization in power bi it is duplicating The data as follows: (even if I filter the table by Sales rep) 

 

Sales repCustomerCreditAmountDate
MaxA1030Today
MaxA2040Today

 

1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @TomMartiG ,

 

According to your description, here are my steps you can follow as a solution.

(1)My test data is the same as yours.

vtangjiemsft_2-1677638294263.png

(2) We can create a calculated column.

Amount = CALCULATE(MAX('Table (2)'[Amount]),'Table (2)'[Sales rep]=EARLIER('Table'[Sales rep]))

(3) Then the result is as follows.

vtangjiemsft_3-1677638403574.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

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

2 REPLIES 2
TomMartiG
Regular Visitor

THANKS! it actually worked.

v-tangjie-msft
Community Support
Community Support

Hi @TomMartiG ,

 

According to your description, here are my steps you can follow as a solution.

(1)My test data is the same as yours.

vtangjiemsft_2-1677638294263.png

(2) We can create a calculated column.

Amount = CALCULATE(MAX('Table (2)'[Amount]),'Table (2)'[Sales rep]=EARLIER('Table'[Sales rep]))

(3) Then the result is as follows.

vtangjiemsft_3-1677638403574.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

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. 

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.