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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
redholt
Frequent Visitor

PQ Help with Arranging Tables for Relationships

I think this is a relatively straightforward one but I cannot for the life of me figure it out. I have some survey data that has respondents in rows and questions in columns with the responses to each question being a number which in turn relates to a text answer in another table. 

 

Table 1 contains the respondents and question data (numbers) e.g.

 

PersonMale or Female?Favourite Colour
123
212

 

and Table 2 is a table listing each question, number and the correspoding text e.g.

 

Male or Female?1Male
Male or Female?2Female
Favourite Colour1Red
Favourite Colour2Green
Favourite Colour3Blue
Favourite Colour4Orange

 

What I want to do is have Table 1 populated with the corresponding text answer in table 2 (so Person 1 would be Female, Blue) but I cant for the life of me figure it out. Could anyone nudge me in the right direction? 

 

Many Thanks

1 ACCEPTED SOLUTION
m_dekorte
Super User
Super User

Hi @redholt,

 

Select the Person column in Table 1, on the Transform tab select: Unpivot Columns, Unpivot Other Columns

Now you can Merge Table 1 and Table 2 setting the appropriate fields as keys (hold down CTRL when you select more than one combination) like so, the [Attribute] from Table 1 with Column 1 from Table 2 AND the [Value] from Table 1 with Column 2 from Table 2

 

Ps. If this helps solve your query please mark this post as Solution, thanks!

View solution in original post

2 REPLIES 2
redholt
Frequent Visitor

Thanks @m_dekorte that was exactly it. Still not got my head around unpivoting but it seems really powerful! 

 

 

m_dekorte
Super User
Super User

Hi @redholt,

 

Select the Person column in Table 1, on the Transform tab select: Unpivot Columns, Unpivot Other Columns

Now you can Merge Table 1 and Table 2 setting the appropriate fields as keys (hold down CTRL when you select more than one combination) like so, the [Attribute] from Table 1 with Column 1 from Table 2 AND the [Value] from Table 1 with Column 2 from Table 2

 

Ps. If this helps solve your query please mark this post as Solution, thanks!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors