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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Substitute "(" being recognized as part of DAX Formula

I'm needing to use Substitute to change "(" that's in part of a product description string in a list I have.

 

The problem I'm running into is that the ( is being recognized in DAX as part of the formula itself.

 

=Substitute([ProductList], "(", "A")

 

Syntax errors out saying that the DAX formula is missing the ) to close the formula.

 

Thoughts ?

5 REPLIES 5
Fowmy
Super User
Super User

@Anonymous 

I did not encounter the error, please share a screenshot of the error:

Fowmy_0-1623414601055.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

What I was attempting to do, and where I thought the error was, was incorrect on my part.

 

OrderActivityNotes

[2021-01-02 08:48:03] Alert Created: Low Inventory; [2021-01-02 08:49:29] Alert status set to New; [2021-01-02 10:05:05] Case Edited: Order Purchase (EMPLOYEEID); [2021-01-02 10:05:05] Alert Closed (EMPLOYEEID)

 

There's a string entry in my product list that we call Activity Notes.  If there's low inventory on a particular product, a step entry is made in the Order Activity Notes column of my product list.

 

I'm attempting to extract the EMPLOYEEID from the string that appears between the "(" and ")".

 

I was using this formula in excel where I used to house the information prior to now having it in Power BI.

 

It seems that DAX doesn't translate the formula as it did in Excel.

 

= SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE([OrderActivityNotes],"(",REPT(" ",LEN([OrderActivityNotes]))),LEN(([OrderActivityNotes]))),")","")))
 
Which ends up with this error: The syntax ")" is incorrect.  And it points it to this part of the formula at the end: ,")","")))

Sorry for the added story, I really thought it had something to do with trying to find "(" and Dax "seeing" the ( as part of the formula as an open 

 

amitchandak
Super User
Super User

@Anonymous , Try like

 

=Substitute([ProductList], "\(", "A")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

SUPER NOOB MOVE...

 

I nested too many ) in the formula, and didn't check my work overall.

 

I figured it out.

SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE([ProductList],"(",REPT(" ",LEN([ProductList]))),LEN([ProductList]))),")","")

Hope it works now?

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors