Powerbi - Expression. Syntaxerror: Token Comma Expected

Powerbi - 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 numeric 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.

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" `)

Or is there another way to say, I need a new column to say "if" at a minimum three of the four columns, their values are greater or equal to 65? That is really what I am trying to accomplish.

Many thanks!

1 Answer

I structured my table(s) differently. I called the parent table (to the 4 options per group) "Menu", which consists of just MenuID. Then I separated the other columns plus MenuID to another table and unpivoted all but the MenuID column, so my table is {MenuID, Protein, Value} (for example {M1, Beef, 70}. Now that I have a parent table and a child table, I can just create a calculated column like this in the Menu table:

IsOK = IF(COUNTROWS(
            FILTER(
                RELATEDTABLE('Proteins'),
                [Value]>=65
            )
    )>=3,True,False)

and it works as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Maya Lin-Takahashi
Author

Maya Lin-Takahashi

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.