Forum Discussion
Anonymous
3 years agoNot applicable
Power Query : Extract text before delimiter with condition
Hi,
I have the Name column and would like to extract it as the Expecting Name (Result):
| Name | Expecting Name |
| AZER.SDD | AZER |
| AZEDT.FV | AZEDT |
| AZERZ.cFS | AZERZ |
| VSFS.DFS | VSFS |
| 12.12.12 | 12.12.12 |
| 12.34 | 12.34 |
| VSD.ZRE | VSD |
| DFS.RF | DFS |
| 12.234 | 12.234 |
If name starts by 12 , Expecting Name = Name
IF name starts by letter, expecting name = text before the first delimiter
Thank you in advance for your help.
Tg
Hi Anonymous ,
Do the TextBeforeDelimiter option and then change the code to:
= Table.AddColumn(Source, "Text Before Delimiter", each if Text.Start([Name], 2) = "12" then [Name] else Text.BeforeDelimiter([Name], "."), type text)Has you can see the part of the split is updated to an IF statement:
2 Replies
- MFelixSuper User
Hi Anonymous ,
Do the TextBeforeDelimiter option and then change the code to:
= Table.AddColumn(Source, "Text Before Delimiter", each if Text.Start([Name], 2) = "12" then [Name] else Text.BeforeDelimiter([Name], "."), type text)Has you can see the part of the split is updated to an IF statement:
- AnonymousNot applicable
Thank you for your help