Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Add 2nd table list to row on 1st table based on common key then expand

I have 2 tables with the following data:

Table 1 -  Issues table

Issue Project
10010
6005
30012
4008
50010
61012
3015
3025

 

Table 2 - Holds relationship of product areas to a project

 

ProjectProduct Area
12pa_50
12pa_52
12pa_45
10pa_16
10pa_12
8pa_100
5pa_11
5pa_55

 

I want to get to: Table 1 being

IssueProjectProduct Area
10010pa_16
10010pa_12
2005pa_11
2005pa_12
30012pa_50
30012pa_52
30012pa_45
4008pa_100
50010pa_16
50010pa_12
60012pa_50
60012pa_52
60012pa_45
3015pa_11
3015pa_12

 

The reasons for this is I want to filter on Product Area in the final report. I will handle the duplicates with measures.

 

I can't get table 1 to join with table 2 on Project. It says I can't join m & m.

 

I think I need to move table 2 rows in as a comma separted list on each row of table 1 based on the project.

 

Then I need to expand each list getting the resulting rows. How does one do this in the UI so the m-code is correct.

 

Thanks!!!

  • I have added the two tables to a pbix file

    And gone for a merge.

    And there doesnt appear to be any problems for me either.  Are you trying to join them in the actual data model?

8 Replies

  • camargos88's avatar
    camargos88
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous ,

     

    The merge function in Power Query doesnt work ? It will replicate the repeated values, like you said.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Ricardo,

       

      I can't directly join. It's a many to many relationship.

       

      "I can't get table 1 to join with table 2 on Project. It says I can't join m & m."

       

      Thanks!

      Steven

      • camargos88's avatar
        camargos88
        Icon for Community Champion rankCommunity Champion

        Anonymous ,

         

        If you are using Power Query, you don't get this error, it will replicate with n number of duplicated rows.

         

        Can you post a print how you are getting this error ?

  • v-eachen-msft's avatar
    v-eachen-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    It doesn't look like an error which is in power query, I could merge tables properly. What did you do to cause this error?

     

    • Anonymous's avatar
      Anonymous
      Not applicable

       

      here the results of the merge I suggested. seems what you expect

      except for the issue 200 that you have in the output is not present in the input tables 

       

       

       

      PS

      perahpas you use a old version of PBI?

  • DebbieE's avatar
    DebbieE
    Icon for Community Champion rankCommunity Champion

    I have added the two tables to a pbix file

    And gone for a merge.

    And there doesnt appear to be any problems for me either.  Are you trying to join them in the actual data model?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Been on vacation would have responded sooner. Thanks for your efforts. I retried and I was also successful. I have no idea why it gave me push back but now I'm able to move on. Again, thank you very much for your time. Well apprciated.