Forum

Notifications
Clear all

If then statement

2 Posts
2 Users
0 Reactions
190 Views
(@tc_owen)
Posts: 3
Active Member
Topic starter
 

I am getting a Token RightParen error message for this formula:

if(Text.PositionOf([Question],"performance")>0 and [Answer]="5" then [Responses] else 0)

 

In plain English

[Question] is a field that has a question that may contain the word "performance".

So if Question contains the string "performance" it will give a value and if the value is >0, then it is TRUE.

AND

If the answer was a "5" (on a scale from 1-5) 

then bring back the value in [Responses] 

else

0

 

I've counted the parenthesis and I have equal amounts.

What am I missing?

 

Any guidance would be greatly appreciated.

 
Posted : 14/04/2018 10:35 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Timoth,

If the Answer column contains numbers then you don't wrap the 5 part in double quotes. Also, 'if' in Power Query doesn't have opening and closing parentheses.

Try:

if Text.PositionOf([Question],"performance")>0 and [Answer]=5 then [Responses] else 0

Don't forget Power Query is case sensitive, so it's looking for 'performance' in lower case.

Mynda

 
Posted : 15/04/2018 6:50 am
Share: