Search code examples
excelif-statementpowerbipowerquerym

Power Query showing error with IF logic (Token Eof expected error)


I'm creating a custom column. What I want is a 1 if the string in another column says "Positive", else a 0.

Ideally, it should look like something like this:

id Sentiment Positive Tag
1 Positive 1
2 Neutral 0
3 Negative 0

Here's where I'm running into a problem. An error is coming up in my logic:

Code sample : Positive Tag = IF [Sentiment] = "Positive" then 1 else 0

Attempt 1

Attempt 2


Solution

  • The M language is case-sensitive. Try if instead of IF.