Skip to main content

Hi, I have a statement that I will use in other applications, but I am getting an error:

“Cannot mix aggregate or non-aggregate comparisons or results”

if COUNT([Rm Id])=.5 THEN [Rm Type]="dos" ELSE COUNT([Rm Id])=1 END

I wish to count all of the room Id’s as 1 except if the room type is “DOS” (Dual Office Seat) the count will be .5 per DOS seat.

I a calculation possible in Tableau?

3 answers
  1. May 4, 2022, 1:36 PM

    Your syntax makes no sense. You cannot set the value of a calculation like that.

    You appear to be trying to identify all the rows where [Rm Type]='dos', and then assigning a value of 1 or 0.5 depending on the outcome. What you have typed is backwards.

    You probably want to do something like this:

    IF [Rm Type]='dos'

    THEN .5

    ELSE 1

    END

0/9000