cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Partisan
Post Partisan

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

Accepted Solutions
Highlighted
Super User V
Super User V

Re: t fdoRe: PoRe: Extract data of specific character length within parameters

Hi @heytherejem ,

 

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
Highlighted
Helper III
Helper III

PoRe: Extract data of specific character length within parameters

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.

Highlighted
Post Partisan
Post Partisan

t fdoRe: PoRe: Extract data of specific character length within parameters

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. 

Highlighted
Super User V
Super User V

Re: t fdoRe: PoRe: Extract data of specific character length within parameters

@heytherejem ,

 

Can you share some examples ?



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

Proud to be a Super User!



Highlighted
Post Partisan
Post Partisan

Re: t fdoRe: PoRe: Extract data of specific character length within parameters

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

 

Highlighted
Super User V
Super User V

Re: t fdoRe: PoRe: Extract data of specific character length within parameters

Hi @heytherejem ,

 

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors