2 Replies Latest reply on Jul 25, 2016 9:21 AM by sam.hong.0

# How to use IF statements with Number of Records?

Hello,

Is it possible to do a IF statement on number of records to display certain things?

For example, if I have the following:

 Group Number of Records Intended 1 7 Good 2 50 OK 3 100 Too High 4 45 OK 5 20 Good

Basically, I want to create a formula that would create the third column. For example, IF (NUMBER OF RECORDS) is LESS THAN 10 THEN "GOOD".

Here is an example of the real data I am trying to do using the concepts of the above.

When I try the following in Tableau, it gives me all null values.

IF [Number of Records] <= 10 THEN "GOOD"

ELSEIF [Number of Records] >= 50 THEN "TOO HIGH"

ELSE "TBD"

END

Even though the number of records falls into the above formula, it always displays TBD.

• ###### 1. Re: How to use IF statements with Number of Records?

Hey Sam,

"Number of Records" is simply a "1". Aggregate it with SUM:

IF SUM([Number of Records]) <= 10 THEN "GOOD"

ELSEIF SUM([Number of Records]) >= 50 THEN "TOO HIGH"

ELSE "TBD"

END

• ###### 2. Re: How to use IF statements with Number of Records?

Thank you!!