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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
tijuemson
Frequent Visitor

returning value inside bracket

Hi guyz

 

i have the following values in a column  i want to make a calculated column where if there is a bracket then i want the value inside the bracket if there is no bracket then just the normal value

 

data looks like this

 

123

456

425

458(548)

856

458

458(586)

 

any help is appreciated

thanks

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @tijuemson 

Download this sample PBIX with solution

To do this in a Calculated Column use this code

 

Column = IF(CONTAINSSTRING('Table'[Data],"("),MID('Table'[Data],FIND("(",'Table'[Data])+1,FIND(")",'Table'[Data])-FIND("(",'Table'[Data])-1),'Table'[Data])

 

colc.png

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

If the number of digits in the bracket are always of 3 digits, then you may use Column By Example in the Query Editor.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
PhilipTreacy
Super User
Super User

Hi @tijuemson 

Download this sample PBIX with solution

To do this in a Calculated Column use this code

 

Column = IF(CONTAINSSTRING('Table'[Data],"("),MID('Table'[Data],FIND("(",'Table'[Data])+1,FIND(")",'Table'[Data])-FIND("(",'Table'[Data])-1),'Table'[Data])

 

colc.png

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


mahoneypat
Employee
Employee

This is much easier in the query editor where you can use the button on the ribbon Extract button and Text Between Delimiters of ( and )

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Fabric Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.