Forum Discussion

NahuelK's avatar
NahuelK
New Member
1 year ago
Solved

Referencing one Table with Another

Hi all!
My problem is as follows:
I have two tables:

Table1

IDAttribute 1Attribute 2Attribute 3
1x1r1z4
2x4r1z2
3x4r4z4

 

Table2

AttributecodeReference
x1Country code AR
x2Country code US
... 
z4Speed range 500

 

I would like to have a result file or result table, that combines both and does not show the code but shows the Reference:

Tableresult

IDAttribute 1Attribute 2Attribute 3
1Country Code ARxxxxxSpeed range 500
2Country Code ZAxxxxxSpeed range 300
3Country Code ZArrrrrrrSpeed range 500


Is this possible to do without manually updating the table in Excel for example?

Best,

Nahuel!

    1. Load Table1 and Table2 into Power Query.
    2. Unpivot Table1:

    Select Attribute 1, Attribute 2, Attribute 3 → Right-click → Unpivot Columns.

    1. Merge with Table2:

    Merge on Value (from Table1) and Attributecode (from Table2) → Left Join.

    1. Expand the Reference column from Table2.
    2. Pivot back:

    Select Attribute column → Pivot Column → Use Reference as values.

5 Replies

    1. Load Table1 and Table2 into Power Query.
    2. Unpivot Table1:

    Select Attribute 1, Attribute 2, Attribute 3 → Right-click → Unpivot Columns.

    1. Merge with Table2:

    Merge on Value (from Table1) and Attributecode (from Table2) → Left Join.

    1. Expand the Reference column from Table2.
    2. Pivot back:

    Select Attribute column → Pivot Column → Use Reference as values.

  • Hi NahuelK ,

     

    Yes, it's absolutely possible to do this without manually updating Excel. In Power BI or Power Query, you can transform the data dynamically. First, you'd unpivot Table1 so that the attributes (Attribute 1, 2, 3) become rows instead of columns, keeping the ID alongside each. This creates a long table where each row shows an ID, the attribute name, and its value. Then, you merge this unpivoted table with Table2 by matching the attribute values (like x1, r1, z4) to the Attributecode in Table2. This brings in the corresponding Reference description. Once that’s done, you pivot the table back using the attribute name so that each attribute returns to its original column layout, but now showing the descriptive Reference instead of the code. The result is a fully dynamic transformation where you no longer see cryptic codes but readable values like “Country Code AR” and “Speed range 500,” all without touching the data manually.

     

    Best regards,

  • v-kathullac's avatar
    v-kathullac
    Community Support

    Hi NahuelK ,

    we would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.

    If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

    Regards,

    Chaithanya

  • v-kathullac's avatar
    v-kathullac
    Community Support

    Hi @NahuelK ,

    we would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.

    If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

    Regards,

    Chaithanya

  • v-kathullac's avatar
    v-kathullac
    Community Support

    Hi @NahuelK ,

    we would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.

    If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

    Regards,

    Chaithanya