Forum Discussion

MarkoG's avatar
MarkoG
New Member
1 year ago
Solved

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

  • 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.

    • MarkoG's avatar
      MarkoG
      New Member

      Great, this works perfectly. Thank you for the detailed pictures and explanaition

    • MarkoG's avatar
      MarkoG
      New Member

      Thank you for the help, but the other post resolved my issue in a better way. Thank you again