The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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"
)
Solved! Go to Solution.
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
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