4 Replies Latest reply on Aug 17, 2016 7:56 AM by Rick James

    cannot mix aggregate and non-aggregate expressions

    Rick James

      Hi In Tableau Desktop 9.2.7 - I come across this issue and not sure how to fix it.

       

      I have a custom SQL query

      1. I have field called "Contacts" (Dimension)

      2. I created a calc to count distinct of the above field and named the filed "Count"   ZN(LOOKUP([Contacts],0))

      3. Now I have to create another calc to pulg this "Count" field but getting below error.

       

       

      if [Product] = "eggs" AND [type] = 'white' then [Count] end

       

       

      Error: cannot mix aggregate and non-aggregate comparisons or results in 'if' expressions --- How do I fix this?

       

      Please share your thoughts.

       

      Thank you!