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
NiugeS
Helper V
Helper V

Search for text in Value and replace with Value from another column in another table

Hi all.  Have been trying to get some sense of this and looked up several posts but can't really work this out.  A bit new to PowerBI so any guidance on where I might find answers appreciated.  


I have two tables; one with items, user ids and user names and another items and comments.  The comments only display the UserID and not the name.


I'm looking to create a new column that has the comments with the name rather than the UserID.

 

Table1 ItemsTable1 
ItemAccountIDsNames
1245[~accountid:User123abc]; [~accountid:User983];  [~accountid:UserAB328]Joe; Lucy; Sarah
1256[~accountid:UserAB328]Sarah
1259[~accountid:User123abc]; [~accountid:User123]Joe; John

 

Table2 Comments  
IDDateCommentDesired Result
124501/01/2020Hey [~accountid:User123abc], hope all is fine.   [~accountid:User983] Can you help [~accountid:UserAB328]?Hey Joe, hope all is fine.   Lucy Can you help Sarah?
124520/01/2020Yeah no problem [~accountid:UserAB328]Yeah no problem Sarah
125615/03/2020[~accountid:User123abc] You got this?Joe You got this?
125917/03/2020[~accountid:User123abc] & [~accountid:User123] will take care of this.Joe & John will take care of this.

 

 

Any guidance on where to start or where to look would be most helpful.

Thank you

1 ACCEPTED SOLUTION
kentyler
Solution Sage
Solution Sage

here is a sample that does step one

it matches the names to the user id's in the first table

https://drive.google.com/file/d/1FRtRi_075qeoqPkiGYVnhjimVhzSZFGN/view?usp=sharing
match.PNG
I won't try to explain the steps here. If you'd like to do a session and go over them email me at ken at 8thfold dot com





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


View solution in original post

12 REPLIES 12
kentyler
Solution Sage
Solution Sage

here is a sample that does step one

it matches the names to the user id's in the first table

https://drive.google.com/file/d/1FRtRi_075qeoqPkiGYVnhjimVhzSZFGN/view?usp=sharing
match.PNG
I won't try to explain the steps here. If you'd like to do a session and go over them email me at ken at 8thfold dot com





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


a short youtube to try to explain the steps i took https://youtu.be/-7UuOb7kPJQ





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


this is as far as i'm going to get today

heyjoe.PNG

you can see that we manage to replace the codes by looking up the names
next step will be to coalesce the words back into a sentence





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


OK

I was able to get a little further with another calculated column 

and this measure
Full String =
VAR row_id = Comments[ID]
VAR result = calculate(CONCATENATEX(Comments,Comments[Name_for_ID] & " "),all(Comments),Comments[ID]=row_id)
RETURN result
full_string.PNG
and then we let a table graphic work its magic to eliminate the duplicates
nodups.PNG




Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Here's a short Youtube trying to explain what I did 





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


@kentyler  Oh my!  I wake up to all of this!  Sorry didn't get back to you yesterday when you had posted all of this, i'm in the UK.

 

Thank you so much - I haven't had a chance to review everything but will do so but thank you so much!

🙂

Glad it made you happy. If you'd like to do an online session and explore further. I'm around all day. Email me at ken at 8thfold dot com





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


@kentyler hey - only just getting a chance to look at this a bit now... thanks again.

Thanks Ken - just need to set some time aside to have a look at it properly to see it all.  I'm sure I will have questions!  Thank you so much for your help!

 

 

@kentyler Thank you for the quick reply and assistance.  I've had a brief look at the steps and kinda understand.  I'll need to spend a bit more time working it out before I try and replicate some of the steps in my own report.

 

Regarding the 2nd table and replace the userid with the actual name, is there any suggestions of terms I should be looking for?

 

 

I think you will  have to loop over the string, finding each value between []s and look it up in table 1 and then replace the string with the value you look up. Pretty sure it can be done. I will try to work out a beginning solution for you and post a new version of the power bi file.





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


@kentyler  Thank you for your help - i'll do some searches and see if I can find out anything at my end.  I think i'm understanding some of the steps in the first part.. although I would never had got there 🙂

 

 

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.