samedi 26 septembre 2015

Resolve aggregate and Non-aggregate mix error for IF results in Tableau

I am trying to do the following in Tableau.

If the chosen key figure is sales or volume (non-aggregate fields) then call calculation1 else calculation 2.

IF ATTR([Choose Key Figure])= "Sales"
THEN [Periodic Calculation]
ELSEIF ATTR([Choose Key Figure])= "Volume"
THEN [Periodic Calculation]
ELSEIF ATTR([Choose Key Figure])="profit"
THEN [Periodic Calculation 2]
ELSEIF ATTR([Choose Key Figure])="price per unit"
THEN [Periodic Calculation 2]
END 

But I am getting the following error: "Cannot mix aggregate and non-aggregate comparisons or results in 'IF' expressions."

Can anyone help with how to work around this error?

Thanks.

Aucun commentaire:

Enregistrer un commentaire