Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi,
I have a column in one of my data sources that holds staff ID numbers, but I need it to show as the staff members name.
I've used a lookup value against another table, but the trouble I am having is that it's not returning all the names because there are multiple staff ID's per cell in each line of data in the table as it was a "Table" but I extracted the values.
The dax/new column I have used is:
...which will only return data with a single ID.
I'll provide tan example below so you can see what I mean - the cell with multiple values won't return names. Ideally I'd like it to return all the IDs as names in that new column.
Any help would be great - apologies, I am not well versed in PBi as I only use it occasionally.
Project Team (Staff Involved ID) | Project Team Staff Names (as per dax above) |
643 | "Person A First Name" "Person A Last Name" |
99, 26, 41, 579, 43, 181, 78, 145, 124, 173, 1033, 28, 27, 766, 300, 643 | |
336 | "Person B First Name" "Person B Last Name" |
Solved! Go to Solution.
Hi , @Charlie1234
According to your description, you want to lookup value from one table by ids , and in a row , you have multiple ids.
For your need , here are the steps you can refer to :
(1)This is my test data:
(2)We can click "New Column" and enter this:
Column = VAR Items1 = SUBSTITUTE ( [IDs], ",", "|" )
VAR T1 = GENERATESERIES ( 1, COALESCE ( PATHLENGTH ( Items1 ), 1 ), 1 )
VAR T2 = SELECTCOLUMNS ( T1, "@Item", PATHITEM ( Items1, [Value] ) )
var T3 = ADDCOLUMNS(T2, "name" , LOOKUPVALUE('Name'[FirstName],'Name'[ID],VALUE([@Item])) & LOOKUPVALUE('Name'[LastName],'Name'[ID],VALUE([@Item])))
return
CONCATENATEX(T3, [name] , ",")
Then wen can get this:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi , @Charlie1234
According to your description, you want to lookup value from one table by ids , and in a row , you have multiple ids.
For your need , here are the steps you can refer to :
(1)This is my test data:
(2)We can click "New Column" and enter this:
Column = VAR Items1 = SUBSTITUTE ( [IDs], ",", "|" )
VAR T1 = GENERATESERIES ( 1, COALESCE ( PATHLENGTH ( Items1 ), 1 ), 1 )
VAR T2 = SELECTCOLUMNS ( T1, "@Item", PATHITEM ( Items1, [Value] ) )
var T3 = ADDCOLUMNS(T2, "name" , LOOKUPVALUE('Name'[FirstName],'Name'[ID],VALUE([@Item])) & LOOKUPVALUE('Name'[LastName],'Name'[ID],VALUE([@Item])))
return
CONCATENATEX(T3, [name] , ",")
Then wen can get this:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Thank you this is exactly what I was looking for!
that sounds doable. Please provide sanitized sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.