Intellipaat Back

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

I am using SQL query in Tableau calculated field 

case when [count_total_cre] <= 76 then (sum([count_total_cre])*16) else 0 end 

This query works in SQL without giving any error message but on putting it in the calculated field it shows an error message as

Syntax error (Identifier is missing)

so what are those identifiers which I am missing during the calculation?

1 Answer

0 votes
by (3.1k points)

You can use if statement in this case for your expression in the calculated field as:

if sum([count_total_cre]) <= 76 then (sum([count_total_cre])*16) else 0 end 

 And if you want to do with case statement only in Tableau, Then this will be your format :

  CASE [sales]

  WHEN 76 THEN [sales]*16

  WHEN X THEN Y

  ELSE Z 

  END

For more details on the calculated field, you can check tableau tutorial

Browse Categories

...