Forum Discussion

LeahS's avatar
LeahS
Frequent Visitor
3 years ago
Solved

Relationships with Column Names

I'm new to Power BI.  I'm trying to create a relationship between my tables of client information and the data itself for filtering.  Right now in my data tables, the client name is the column name.  I would like to match this to a value in the "client" column of my client information table, but can't seem to figure out how.  Do any of you have any ideas on how to work around this issue?

 

Example

"Le St", a value in the "Clients" column of client information table

In Level 1 Table, "Le St" is a column name with rows being dates.  So each row has how many level 1's "Le St" had on that date.

 

Thanks!

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi LeahS ,

     

    To create a relationship between your client information table and the Level 1 table, you'll need to unpivot the Level 1 table so that the client names become values in a single column instead of being column names.


    Go to the Data view->Select the Level 1 table->In the Home tab, click on Transform Data to open the Power Query Editor->In the Power Query Editor, select all columns except the date column->Right-click on one of the selected columns and choose Unpivot Columns->Rename the generated Attribute column to "Clients" and the Value column to something meaningful, like "Level 1 Count"->Click Close & Apply to apply the changes

    Now, you should have a transformed Level 1 table with a "Clients" column that can be used to create a relationship with the client information table. To create the relationship:


    Go to the Model view->Drag the "Clients" column from the Level 1 table to the "Clients" column in the client information table->Power BI will automatically create a relationship between the two tables.

     

    Best Regards,

    Neeko Tang

    If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi LeahS ,

     

    To create a relationship between your client information table and the Level 1 table, you'll need to unpivot the Level 1 table so that the client names become values in a single column instead of being column names.


    Go to the Data view->Select the Level 1 table->In the Home tab, click on Transform Data to open the Power Query Editor->In the Power Query Editor, select all columns except the date column->Right-click on one of the selected columns and choose Unpivot Columns->Rename the generated Attribute column to "Clients" and the Value column to something meaningful, like "Level 1 Count"->Click Close & Apply to apply the changes

    Now, you should have a transformed Level 1 table with a "Clients" column that can be used to create a relationship with the client information table. To create the relationship:


    Go to the Model view->Drag the "Clients" column from the Level 1 table to the "Clients" column in the client information table->Power BI will automatically create a relationship between the two tables.

     

    Best Regards,

    Neeko Tang

    If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

  • LeahS's avatar
    LeahS
    Frequent Visitor

    Thanks Neeko!  That worked for me.  The relationships are all functioning now.  I appreciate the help!