Forum Discussion
Combine data from 2 tables with different headers
Dear all,
Is it possible to combine data from 2 below tables:
I would like to compare "First Class" data from both tables, but as you can see the dates are in headers in table2. I cant manage to pivot any od the tables in order to get the "same" picture in both of them. Any suggestions on what would be the best approch?
I would like to get data orginized like below in column "Data from Table2".
Hi MarkoG ,
Here is your Solution.
1. First unpivot Table 2 all the date columns in query editor as shown below.
2. Now after loading, go to table section, open table 2 and change data type of attribute to date.
3. Now go to table 1 and insert new column and use below dax to lookup
Data from Table 2 = LOOKUPVALUE('Table 2'[Value],'Table 2'[Mod],'Table 1'[Mod],'Table 2'[Sta],'Table 1'[STA],'Table 2'[Attribute],'Table 1'[Date])If this works, please accept as solution.
4 Replies
- Rupak_biSuper User
Hi MarkoG ,
Here is your Solution.
1. First unpivot Table 2 all the date columns in query editor as shown below.
2. Now after loading, go to table section, open table 2 and change data type of attribute to date.
3. Now go to table 1 and insert new column and use below dax to lookup
Data from Table 2 = LOOKUPVALUE('Table 2'[Value],'Table 2'[Mod],'Table 1'[Mod],'Table 2'[Sta],'Table 1'[STA],'Table 2'[Attribute],'Table 1'[Date])If this works, please accept as solution.
- MarkoGNew Member
Great, this works perfectly. Thank you for the detailed pictures and explanaition
- ryan_mayuSuper User
you can select the first 3 column in table 2 and unpivot other tables
then in table 1 and you use merge query function
press ctrl and choose columns , you can see number beside the column headers. Make sure the sequences are matching.
then expand the column
pls see the attachment below
- MarkoGNew Member
Thank you for the help, but the other post resolved my issue in a better way. Thank you again