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
Anonymous
Not applicable

column to row relationship

Hi,

I have two tables(table1 and table 2), the column names of table 1(1,2,3,4,5)

is refering to values of table 2, how can we get a column(table1) to row(table2) relationship.

 

Table 1

12345
hofga
hkgse
ijfjs
ojjf

f

 

Table 2

ValuesColumnHeading
1What is your name?
2Where are you from?
3How are you doing?
4Can I help you?
5Where are you going to?

 

Thanks,

Ravi

2 ACCEPTED SOLUTIONS
mattbrice
Solution Sage
Solution Sage

Unpivot Table 1 in query editor then relate 'Table 1'[New Value Column] to 'Table 2'[Values].

View solution in original post

v-qiuyu-msft
Community Support
Community Support

Hi @Anonymous,

 

To relate two tales, there should have a common column in those two tables. In your scenario, you can open Query Editor, select the query Table1, select all columns then click Unpivot Columns.

 

q5.PNG

 

 

Then apply the changes, go to the report, create a relationship. For more information, please check attached .pbix file.

 

q6.PNG

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Gatot
Regular Visitor

Hi,

 

I have two tables , table 1 is main table and table 2 is Unpivot column. I m trying to make relationship between them but unfortunately an error message shown ("Column "INTNR" in Tables 2 contains a duplicate value and not allowed).

Tables 1

INTNRD2D3D4D4_1D6
70910First vehicle everMale 35 ~ 39 yearsSelf employee
70911Additional vehicle for my householdMale Older than 50, specifySelf employee
70912Additional vehicle for my householdFemale 40 ~ 49 yearsHousewife
70913First vehicle everMale 40 ~ 49 yearsGovernment employee
70914Replacement vehicle for my householdMale 40 ~ 49 yearsPrivate company employee
70915Replacement vehicle for my householdFemale 35 ~ 39 yearsPrivate company employee

 

Table 2 (unpivot column)

INTNRAttributeValue
70910NATIONALNATIONAL
70910REGIONREGION
70910DEALERBlank
70911NATIONALNATIONAL
70911REGIONREGION
70911DEALERBlank
70912NATIONALNATIONAL
70912REGIONREGION
70912DEALERBlank
70913NATIONALNATIONAL
70913REGIONREGION
70913DEALERBlank
70914NATIONALNATIONAL
70914REGIONREGION
70914DEALERBlank
70915NATIONALNATIONAL
70915REGIONREGION
70915DEALERBlank

 

 

Thanks,

Gatot

v-qiuyu-msft
Community Support
Community Support

Hi @Anonymous,

 

To relate two tales, there should have a common column in those two tables. In your scenario, you can open Query Editor, select the query Table1, select all columns then click Unpivot Columns.

 

q5.PNG

 

 

Then apply the changes, go to the report, create a relationship. For more information, please check attached .pbix file.

 

q6.PNG

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello! Thank you for sharing this, it was very helpful and worked! But in the process I lost the data from the original Table1. Is there a way to unpivot, create the relationship, and then transform back to the original table while maintaining the new relationship? I tried pivoting, but it didn't work.

Anonymous
Not applicable

Thanks All, UnPivot other columns worked well for me!

mattbrice
Solution Sage
Solution Sage

Unpivot Table 1 in query editor then relate 'Table 1'[New Value Column] to 'Table 2'[Values].

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.