Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Matching Columns in 2 Tables

Hi everyone!

 

New PBI user here 🙂 I have a table that has different codes related to dates they were inputted, and I have another table that has those codes and what each code means:

 

Table 1    Table 2     
DateCode CodeMeaning 
7-JanR2 F5 blue  
9-JanF5 T4green 
11-JanC7 C7yellow 
13-JanT4 R2red 
   P6brown 
   L9purple 

 

 

I want a visualization that will show the Meaning of the codes related to the codes on Table 1. I already set a relationship between the "Code" columns in both tables. However, when I do a table visualization with the "Code" Column from Table 1, and the "Meaning" Column in Table 2, they are not matching up. 

 

Please help!!

  • Hi, Anonymous 

     

    Based on your description, I created data to reproduce your scenario. It works propperly on my side. The pbix file is attached in the end.

     

    Table1:

     

    Table2:

     

    There is a relationship between two tables.

    Result:

     

    You may also create a measure as below.

    Meaning Measure = 
    MAXX(
        FILTER(
            ALL(Table2),
            Table2[Code]=SELECTEDVALUE(Table1[Code])
        ),
        [Meaning]
    )

     

    Result:

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • HotChilli's avatar
    HotChilli
    Community Champion

    None of them match up or just some?

     

    Check for the same data type in both tables.

    Check for spaces or other hidden characters.

    You can clean the data in Power Query using Trim or Clean

  • v-alq-msft's avatar
    v-alq-msft
    Community Support

    Hi, Anonymous 

     

    Based on your description, I created data to reproduce your scenario. It works propperly on my side. The pbix file is attached in the end.

     

    Table1:

     

    Table2:

     

    There is a relationship between two tables.

    Result:

     

    You may also create a measure as below.

    Meaning Measure = 
    MAXX(
        FILTER(
            ALL(Table2),
            Table2[Code]=SELECTEDVALUE(Table1[Code])
        ),
        [Meaning]
    )

     

    Result:

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you! The measure worked!