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
vnqt
Helper IV
Helper IV

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): 

 

NameExpecting Name 
AZER.SDDAZER
AZEDT.FVAZEDT
AZERZ.cFSAZERZ
VSFS.DFSVSFS
12.12.1212.12.12
12.3412.34
VSD.ZREVSD
DFS.RFDFS
12.23412.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

 

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @vnqt ,

 

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:

 

MFelix_0-1673861438237.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi @vnqt ,

 

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:

 

MFelix_0-1673861438237.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thank you for your help

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.