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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

PowerQuery - Extract Data if contain

Hi, I am working on PowerQuery.

May I ask how I could extract the data from ( ) only if there is a ( )

ExampleDesired result
TomTom
1(Peter)Peter
DavidDavid
OscarOscar
2(Alex)Alex

Many thanks!

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

Please try the following methods. Use Split Column twice in Power query. first split with "(" and second split with ")".

vzhangti_0-1657021115365.pngvzhangti_1-1657021132742.pngThe results are shown in the figure.

vzhangti_2-1657021180083.png

Then add a custom column.

if[Example.2.1]<>null then [Example.2.1] else [Example.1]

vzhangti_3-1657021273493.png

You will get the results you expect.

vzhangti_4-1657021291774.png

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

Please try the following methods. Use Split Column twice in Power query. first split with "(" and second split with ")".

vzhangti_0-1657021115365.pngvzhangti_1-1657021132742.pngThe results are shown in the figure.

vzhangti_2-1657021180083.png

Then add a custom column.

if[Example.2.1]<>null then [Example.2.1] else [Example.1]

vzhangti_3-1657021273493.png

You will get the results you expect.

vzhangti_4-1657021291774.png

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

otravers
Community Champion
Community Champion

Try the "column from example" feature, it's pretty good at figuring things out:

https://docs.microsoft.com/en-us/power-query/column-from-example

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.