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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

RightParen error in Custom Column

Can someone help with this formula. I'm getting a RightParen error

 

if( [#"Which Centre do you work in?"] = "Box Hill" then "Australia"

 

 

I need to do multiple if then else statements whereby it looks that the centre and determines a country. In this example if the centre is Box Hill I want the column to say Australia... I haven't done the else part of the formula cause it doesn't even like the text "Australia'. The red squiggle line is under "Aus so it does not like me typing "Australia" Why?

 
1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

You can add a conditional column, it is easier way to achieve your goal.

https://radacad.com/conditional-column-in-power-bi-using-power-query-you-can-do-anything

Capture7.JPG

 

Best Regards
Maggie
Community Support Team _ Maggie Li
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

8 REPLIES 8
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

You can add a conditional column, it is easier way to achieve your goal.

https://radacad.com/conditional-column-in-power-bi-using-power-query-you-can-do-anything

Capture7.JPG

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
sturlaws
Resident Rockstar
Resident Rockstar

hi @Anonymous,

 

assuming your are trying to do this in Power Query, the syntax of the if-function is like this:

if test then value_if_true else value_if_false

without any paranthesis.

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

Anonymous
Not applicable

No this does not work with or wthout parenthesis

 

Reminder I'm after text not a value

if test then text_if _true else text _if_false

I can't make out what your column name is, but if you add a custom column in power query this is the syntax

if [column name] = "Box Hill" then "Australia" else "Other"

 

Notice that the comparison is case sensitive

 

Cheers,
Sturla

Anonymous
Not applicable

I domnt type in the column name I insert it from the list provided

 

if( [#"Which Centre do you work in?"] = "Box Hill" then "Australia" else (from here a new if test begins)

 

RightParen Error.PNG

 

as soon as I start typing "Australia" the error appears

In the screen shot you just provided, there is a paranthesis after if. The red underline highlighting error, behaves a bit erratic, so when I write this custom column it pops up on every word, even if there is no error. But once I get to the end, it disappears, and the formula evaluates correctly

Anonymous
Not applicable

It does not disappear. I have tried completing the formula many times

 

The RightParen error remains and the "ok" button id greyed out so I cannot click on it

RightParen2 Error.PNG

 

 

The code you posted starts with

= if (

 

Why the paranthesis?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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