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
megm001
Advocate I
Advocate I

Relationship between Column Header and another table

I have a table of information about my column headers and would like to connected them. Is it possible to create a relationship between column headers and another table. 

For example, like this (https://community.tableau.com/thread/152991) in Tableau.

 

Thank you!

2 ACCEPTED SOLUTIONS

Looks to me like this is only possible when you transpose TableA.

 

Below the code how it looks like in Query Editor - Advanced Editor:

 

let
    Source = TableA,
    #"Demoted Headers" = Table.DemoteHeaders(Source),
    #"Transposed Table" = Table.Transpose(#"Demoted Headers")
in
    #"Transposed Table"

 

Compilation picture of the resulting table and the relationships:

 

Relationship between Column Header and another table 2.png

 

Going offline now as it's almost midnight over here.

Specializing in Power Query Formula Language (M)

View solution in original post

Maybe there is a workaround to achieve what you eventually require.

I mean: creating a relationship can never be the end goal.

Proabbly you want to end up with some visual(s) with information from both tables.

Specializing in Power Query Formula Language (M)

View solution in original post

9 REPLIES 9
MarcelBeug
Community Champion
Community Champion

Maybe you can use Table.ColumnNames in Power Query.

 

For more specific help, please provide more specific information about your data and your requirements.

If the required information is in the link you provided, please be more specific where exactly in the link the information can be found.

Specializing in Power Query Formula Language (M)

Thank you for your reply @MarcelBeug.

My issue is almost identical to that of Kirstin's in this (https://community.tableau.com/thread/152991) Tableau forum. 

Like Kirstin, I have columns in a table, say A, called f1, f2, ..., f100 (these are Table A's column headers). I also have another table, say B, with corresponding specifics, such as fi's (for i from 1-100) exact question and question type. However, in Table B, I also have a column, say b1, containing each question's id, the fis from above. I'd like to create a relationship between Table A's column headers and column b1 from Table B. Is this possible? How can I do this? Can I do this without downloading Power Query?

Anything is possible with Power Query, which is the "Query Editor" part of Power BI, so it comes with the product.

 

I painted a picture how I understand your input would look like. Table A to the left and table B to the right.

Now you may paint a picture how the result should look like.

 

Relationship between Column Header and another table.png

Specializing in Power Query Formula Language (M)

@MarcelBeug, I'm sorry for the confusion!

Here is what I envisioned Table A (left) and Table B (right) to look like.

Now, I'd like to create a relationship between the column header of Table A and column b1.

 

Column Header Mapping.PNG

Looks to me like this is only possible when you transpose TableA.

 

Below the code how it looks like in Query Editor - Advanced Editor:

 

let
    Source = TableA,
    #"Demoted Headers" = Table.DemoteHeaders(Source),
    #"Transposed Table" = Table.Transpose(#"Demoted Headers")
in
    #"Transposed Table"

 

Compilation picture of the resulting table and the relationships:

 

Relationship between Column Header and another table 2.png

 

Going offline now as it's almost midnight over here.

Specializing in Power Query Formula Language (M)

Unfortunately, transposing Table A is not an option for me. 

Thank you, @MarcelBeug, for your help!

Maybe there is a workaround to achieve what you eventually require.

I mean: creating a relationship can never be the end goal.

Proabbly you want to end up with some visual(s) with information from both tables.

Specializing in Power Query Formula Language (M)

Hello Marcel,

Can you share the post again?

I'm not able to view the solution.

I have a similar situation where I need to connect the header in 1 table with the other table and I don't have the option to transpose.

 

Thanks in advance,

Kunal Shah

Perhaps. Thank you!

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.