Forum Discussion

TomMartiG's avatar
TomMartiG
Regular Visitor
3 years ago
Solved

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

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    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.

    (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.

     

    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. 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    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.

    (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.

     

    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.