Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I have a column that is a bunch of mismatch information, and is delimited by " - ". Luckily, some of it is fairly consistent, like I know some have a phone number at the start that I would like to remove (some with dashes and some without), so for those, I would like to delete using the delimiter, but others I need to keep the information before the delimiter.
For the ones without dashes, I was thinking I could do something like this:
#"Remove Starting Phone Number" = Table.ReplaceValue(#"Sorted Rows", each If Value.Is(Text.BeforeDelimiter([Assignee], " - "), Int64.Type) then Text.BeforeDelimiter([Assignee], " - ") else [Assignee], Text.AfterDelimiter([Assignee], " - "), Replacer.ReplaceText, {"Assignee"})
but I'm getting a Token comma expected error. I’ve also tried Text.StartsWith, but no go. I think my logic is a little flawed…I’ve got a bit of a brain fog going on, so any help to accomplish this would be greatly appreciated.
Solved! Go to Solution.
Well, that's embarrassing...it turns out that error, and the reason the Text.StartsWith didn't work was due to If instead of if...case sensitivity. So, this now works:
#"Remove 555" = Table.ReplaceValue(#"Sorted Rows", each if Text.Start([Assignee], 3) = "555" then Text.Start([Assignee], 13) else "___", "", Replacer.ReplaceText, {"Assignee"})
Not the best way to do it, but at least it works for my current needs. I'll probably change it to remove up to the delimiter for those records, and make my "else" to be more definitive, to be cleaner.
Well, that's embarrassing...it turns out that error, and the reason the Text.StartsWith didn't work was due to If instead of if...case sensitivity. So, this now works:
#"Remove 555" = Table.ReplaceValue(#"Sorted Rows", each if Text.Start([Assignee], 3) = "555" then Text.Start([Assignee], 13) else "___", "", Replacer.ReplaceText, {"Assignee"})
Not the best way to do it, but at least it works for my current needs. I'll probably change it to remove up to the delimiter for those records, and make my "else" to be more definitive, to be cleaner.
don't worry, I didn't catch that either...
Sure, here's the sample data (assume over a hundred cases of each, with different names and numbers, except 555):
Assignee | Contact |
MOB002079 - McGartidy, Friankie | McGartidy, Frankie |
555-325-1369 - DiRiendzi4 | DiRiendzi, Michael |
Williards, Jeff - MOB004444 | Williards, Jeff |
5553241345 - OMH45 | Samson, Rudolf |
555-325-8466 | Jacobson, Pat |
On Call Crew Leader - Brins, Chris | Brins, Chris |
OMH 4 - Eckels, Verina | Eckels, Verina |
Jacobs, John | Fuller, Mark |
I hope to be able to ultimately get to this output:
Assignee | Contact |
McGartidy, Frankie | McGartidy, Frankie |
DiRiendzi4 - DiRiendzi, Michael | DiRiendzi, Michael |
Williards, Jeff | Williards, Jeff |
OMH45 - Samson, Rudolf | Samson, Rudolf |
Jacobson, Pat | Jacobson, Pat |
On Call Crew Leader - Brins, Chris | Brins, Chris |
OMH 4 - Eckels, Verina | Eckels, Verina |
Jacobs, John | Fuller, Mark |
Thank you so much!
Any chance you could post some sample data and expected results?