Reply
ThinkerAlways
New Member
Partially syndicated - Outbound

Expression.SyntaxError: Token Comma expected (Error - any ideas?)

Expression.SyntaxError: Token Comma expected.

 

I am relative new to using PowerBI. I am learning how to query data from a dataset stored in Access Database. 

 

Here is what I am trying to do, there are four columns with numberic data, the four columns are: FISH, GOAT, PORK and BEEF. The script below attempts to comb through the data by asking, if any of the four columns, their data properties is greater than 65, the new column "YesIfGreater65" will populate the word, "Yes" If not, then "No."  Does anyone know why I get the following error? I don't understand.  Thank you much in advance.

 

Expression.SyntaxError: Token Comma expected.

 

PowerQryBI:

 

CheckValues = Table.AddColumn(#"_2015_2022_TACOS", "YesIfGreater65", each [Fish]> 65 [Goat]> 65 [Pork]> 65 [Beef]> 65 then "Yes"
else if [Fish]> 65 [Goat]> 65 [Pork]> 65 [Beef]> 65 then "Yes"
else if [Fish]> 65 [Goat]> 65 [Pork]> 65 [Beef]> 65 then "Yes"
else if [Fish]> 65 [Goat]> 65 [Pork]> 65 [Beef]> 65 then "Yes"
else if [Fish]> 65 [Goat]> 65 [Pork]> 65 [Beef]> 65 then "Yes"
else null, type "No"
)

 

 

1 ACCEPTED SOLUTION
avatar user
Anonymous
Not applicable

Syndicated - Outbound

You have to string the conditions together with "and if"

 

CheckValues = Table.AddColumn(#"_2015_2022_TACOS", "YesIfGreater65", each if [Fish]> 65 and [Goat]> 65 and [Pork]> 65 and [Beef]> 65 then "Yes"
else if [Fish]> 65 and [Goat]> 65 and [Pork]> 65 and [Beef]> 65 then "Yes"
else if [Fish]> 65 and  [Goat]> 65 and [Pork]> 65 and [Beef]> 65 then "Yes"
else if [Fish]> 65 and [Goat]> 65 and [Pork]> 65 and [Beef]> 65 then "Yes"
else if [Fish]> 65 and [Goat]> 65 and [Pork]> 65 and [Beef]> 65 then "Yes"
else "No", type text)

 

--Nate

View solution in original post

1 REPLY 1
avatar user
Anonymous
Not applicable

Syndicated - Outbound

You have to string the conditions together with "and if"

 

CheckValues = Table.AddColumn(#"_2015_2022_TACOS", "YesIfGreater65", each if [Fish]> 65 and [Goat]> 65 and [Pork]> 65 and [Beef]> 65 then "Yes"
else if [Fish]> 65 and [Goat]> 65 and [Pork]> 65 and [Beef]> 65 then "Yes"
else if [Fish]> 65 and  [Goat]> 65 and [Pork]> 65 and [Beef]> 65 then "Yes"
else if [Fish]> 65 and [Goat]> 65 and [Pork]> 65 and [Beef]> 65 then "Yes"
else if [Fish]> 65 and [Goat]> 65 and [Pork]> 65 and [Beef]> 65 then "Yes"
else "No", type text)

 

--Nate

avatar user

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)