Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Extract data of specific character length within parameters

Hi there

I have some really bad quality data I need to use unfortunately and one of the issues is data in parenthesis within this field. I need some of the data in parenthesis, and some I do not.  I want to see what the data looks like if remove data between 1 and 2 character length within parenthesis e.g. (EU) and keep anything greater than 2 characters within parameters e.g. (SGP). 

Is this possible? 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Try this custom column:

 

let _text = Text.Split([Current Column], " ") in

Text.Combine(List.RemoveNulls(List.Transform(_text, each
if Text.StartsWith(_, "(") and Text.EndsWith(_, ")") then
if Text.Length(_) = 3 or Text.Length(_) = 4 then null
else _ else _
)), " ")

 

Capture.PNG



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

Proud to be a Super User!



View solution in original post

5 REPLIES 5
navedkhan
Helper III
Helper III

you could try in PowerQuery, by going to 'Transform data' and then edit that column. there is an option to extract text before and after delimiters.

hope it helps.

Anonymous
Not applicable

It doesn't allow you to specify the number of characters between the delimiters unless I am doing something wrong 

 

I want to say: (??) = remove    (???) = keep. 

@Anonymous ,

 

Can you share some examples ?



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

Proud to be a Super User!



Anonymous
Not applicable

Here are some examples of the data and my desired result

 

Current ColumnDesired Column
MODA KTB (ME)MODA KTB
Petroliam Berhad (PETRONAT)Petroliam Berhad (PETRONAT)
MODA KuwaitMODA Kuwait
Hotel & Property Development (Kenal) LtdHotel & Property Development (Kenal) Ltd
Everhouse LLP (EU)Everhouse LLP

 

Hi @Anonymous ,

 

Try this custom column:

 

let _text = Text.Split([Current Column], " ") in

Text.Combine(List.RemoveNulls(List.Transform(_text, each
if Text.StartsWith(_, "(") and Text.EndsWith(_, ")") then
if Text.Length(_) = 3 or Text.Length(_) = 4 then null
else _ else _
)), " ")

 

Capture.PNG



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

Proud to be a Super User!



Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.