Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (17.6k points)

I have a tableau data grid that I need to count distinct records. If the status is Complete distinct count the RecordID

  IF [Status] = "COMPLETE" THEN COUNTD([Survey ID]) ELSE 0 END)

 But I am getting an error "Cannot mix aggregate and non-aggregate comparisons or results in IF expression". Any ideas? 

1 Answer

0 votes
by (47.2k points)
  • You just need to rearrange the order of things.

COUNTD(IF [Status] = "COMPLETE" THEN [Survey ID] END)

  • This results by returning a Survey ID if the Status is 'COMPLETE' otherwise it will return a NULL to the COUNTD function. NULLs are ignored, so they won't be counted.

Intellipaat offers Tableau Training for the learners to master advanced visualization tools. 

Browse Categories

...