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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

Relate Multiple columns in one table to one column in another?

Hi, 

 

I have a table which tracks approvals.  It has been built using references for individuals, so Person A =10, Person B=11, etc.  I have another table which has the person information so Reference 10 = Person A.  

 

Unfortunately I have 3 approver columns, as each item needs to be approved by a Manager, Finance and Head of. 

 

The columns look something like:

Approver1  Approver2  Approver 3

  10                 15               23

  14                 22               23

 

The second table (Employees) will have 

Reference    Name

  10                Mark

  11                Matthew

 

 

I can build a simple relationship between the tables for Approver1, which gives me the names for that approver.  However, I need to work out a solution where I can do so for all 3 Approvers.  

 

The best option I have so far is to link the same table 3 times, so itll be Employees Table1, Employees Table2, Employees Table3.  Then link Approver1 to Table1, Approver2 to Table2 and Approver3 to Table3.  

 

Is there a more robust & simpler way of obtaining the data from the Employees table to provide the results for all 3 approvers in my Visualisations?

5 REPLIES 5
jdbuchanan71
Super User
Super User

You can apply an Unpivot Columns transformation on your data to get the people in a stack so you can join off a single colum.  I might also rename the columns to 'Manager', 'Finance', 'Head of'

 

approversstart.jpg

 

Select the three columns and Unpivot:

approversunpivot.jpg

Rename the two new columns:

approversend.jpg

Anonymous
Not applicable

@jdbuchanan71 Thanks for that.  

 

It seems I may have missed an important item. 😞 

 

The table with 3 approvers also has a lot of other columns, some of which I will need, for example, approval dates, the item being approved (and all it's details).  I will still need to reference all of this in visualisations.  

That's fine.  When you unpivot just the three approver columns the rest of the line items will be replicated for each of the approvers.

Could you share a sample pbix? We might also be able to split the approvers into a separate table that has whatever the identifier for the thing they approved (like request id).

Your original idea of having three employee tables is also not a bad one.  You can replicate a table in Power BI simbly by clicking new table > give it a name and point it at an existing table.

 

Managers = EmployeeTable
Anonymous
Not applicable

Unfortunately samples aren't available, it's extremely sensitive. 

 

I'll have a play with the unpivot and will see how that goes.  

 

It is nice to try to improve my knowledge when I have a relatively suitable working solution as a fall back. 

Anonymous
Not applicable

That's that theory stuffed:

 

Expression.Error:  Acess to the resource is Forbidden. 

 

I can't unpivot the data.  

 

@jdbuchanan71   Many thanks for your input, it's much appreciated. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors