Forum Discussion
Renaming Table Headers with combined variable IDS as column headers with ID names from another table
- Anonymous2 years ago
Thank you all for the ideas shared, I appreciate it.
I have managed to solve this by creating a lookup table with coded names and full-text names and then renaming the columns using Table.RenameColumns() function.
How many columns are in Table1? Table2 has 1300 rows, are they all used to create columns in Table1?
Is there a unique ID for Table1?
What if you did an UNPIVOT of Table1 that yielded the following:
Unique ID, Column Name, Value
Next, split the Column Name (ABC123_DEF456) by the underscore character, so now you have:
Unique ID, Column Name before the underscore, Column Name after the underscore, value.
Now do a JOIN to Table2 on [Column Name before the underscore] joined to Table2 id. Join again for [Column Name after the underscore].
Expand the joined instances of Table2 to get the name(s) column.
Combine the two Table2.Names with an underscore between them.
Remove everything but the Unique ID, Value, and new Column Name.
Lastly, re-pivot the data.
Keep in mind this is 'air-ware' and may not actually work with your data. It works in my mind, though 🙂
- Anonymous2 years agoNot applicable
Hey ToddChitt , I have 15 tables that I am querying from a database the 1300 rows in Table 2 are categories used across other tables by combining two categories as headers.
Let me try your suggestion, I will revert with feedback.