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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
namitajuneja15
Frequent Visitor

How to write a query on power bi

I am new to POWER BI  and for creating a dashboard I need to join these 2 tables based on index .

 

How do I write a DAX query to join the index of 2nd table to the column name of 1st in POWER BI. Is there any other way to do so?

namitajuneja15_0-1660221626750.png

How do I write a DAX query to join the index of 2nd table to the column name of 1st in POWER BI. Is there any other way to do so?

 

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @namitajuneja15 ,

 

I'd do this in Power Query rather than DAX:

You'll want to import both tables into PQ using 'Get Data'. We'll call the top one TableA and the bottom one TableB.

Once you have TableA open in PQ, select the [ID] column and go to the Transform tab > Unpivot Columns (dropdown) > Unpivot Other Columns.

Now you can go to the Home tab > Merge Queries and merge on TableA[Attribute] = TableB[Index].

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

2 REPLIES 2
namitajuneja15
Frequent Visitor

Thanks a lot guys, Your procedures really helped me tackle the situation

BA_Pete
Super User
Super User

Hi @namitajuneja15 ,

 

I'd do this in Power Query rather than DAX:

You'll want to import both tables into PQ using 'Get Data'. We'll call the top one TableA and the bottom one TableB.

Once you have TableA open in PQ, select the [ID] column and go to the Transform tab > Unpivot Columns (dropdown) > Unpivot Other Columns.

Now you can go to the Home tab > Merge Queries and merge on TableA[Attribute] = TableB[Index].

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.