Forum Discussion

ImprintGroup's avatar
ImprintGroup
Regular Visitor
4 years ago
Solved

Duplicate rows when bringing data from multiple tables

Hello, I am very new to Power BI and I am building my first report. I'm having an issue where I'm getting multiple rows of values that relate to a single record. It's hard to describe the problem so...
  • v-luwang-msft's avatar
    4 years ago

    HI ImprintGroup ,

    Based on your current description, it is caused by the fact that you have a 1-to-many relationship between your table and the table before it. Just like in database, using left join to query two tables, if the fields in table 1 have more than one corresponding value in table 2, this will happen. Your current view is that there should be multiple correspondences between table 3 and other tables.
    Also, according to your description, you only want to display one data in table 3, you can generate a new table based on table 3, and then create a relationship with the new table.

     

    Sample:

    tableA:

    tableB:

    relationship:

    Output:

     

     

    Step1,cancel relationship:

    Step 2, add index on the tableB:

     

    Step 3, base on table B ,create new tableC:

    rank1 = RANKX(FILTER(TableB,TableB[index]=EARLIER(TableB[index])),TableB[Index.1],,ASC,Dense)

    Step4 ,create relationship ,and new visual:

    Did I answer your question? Mark my post as a solution!


    Best Regards

    Lucien