Skip to main content
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MarkoG
New Member

Combine data from 2 tables with different headers

Dear all,

Is it possible to combine data from 2 below tables:

MarkoG_0-1730964948839.png

MarkoG_1-1730964971531.png


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

MarkoG_2-1730965024141.png

 


 

1 ACCEPTED SOLUTION
Rupak_bi
Super User
Super User

Hi @MarkoG ,

Here is your Solution.

1. First unpivot Table 2 all the date columns in query editor as shown below.

Rupak_bi_0-1730970646651.pngRupak_bi_1-1730970674876.png

 

2. Now after loading, go to table section, open table 2 and change data type of attribute to date.

Rupak_bi_2-1730970841098.png

 

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])
Rupak_bi_3-1730970899266.png

If this works, please accept as solution.



Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/

View solution in original post

4 REPLIES 4
ryan_mayu
Super User
Super User

@MarkoG 

you can select the first 3 column in table 2 and unpivot other tables

11.png

 

then in table 1 and you use merge query function

 

12.PNG

 

press ctrl and choose columns , you can see number beside the column headers. Make sure the sequences are matching.

 

then expand the column

 

13.png14.PNG

 

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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

Rupak_bi
Super User
Super User

Hi @MarkoG ,

Here is your Solution.

1. First unpivot Table 2 all the date columns in query editor as shown below.

Rupak_bi_0-1730970646651.pngRupak_bi_1-1730970674876.png

 

2. Now after loading, go to table section, open table 2 and change data type of attribute to date.

Rupak_bi_2-1730970841098.png

 

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])
Rupak_bi_3-1730970899266.png

If this works, please accept as solution.



Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.