3 Replies Latest reply on Jul 13, 2018 10:04 AM by Emily Skoraczewski

# Count if Statement?

Hi -

I would like to count the number of activities if the ranking of the activity is greater than 3. I have the following formula but it does not work:

IF (Ranking)>3 THEN COUNT(Activity) END

Help?

Kate

• ###### 1. Re: Count if Statement?

Kate,

I think you are dealing with the row-level vs. aggregate level calculations difference again (see our thread from earlier today: http://community.tableau.com/thread/124520)

Try this:

SUM(IF Ranking > 3 THEN 1 ELSE 0 END)

That wraps a row level calculation inside an aggregate.  Or you might want to simplify to this:

IF Ranking > 3 THEN 1 ELSE 0 END

and then just SUM the resulting measure.

Hope that helps!

Regards,

Joshua

2 of 2 people found this helpful
• ###### 3. Re: Count if Statement?

I used the formula above, and for some reason, instead of getting a '1', I'm getting a '2' entered in my calculation:

Count Function: IF [Rapid Check] <= 2 THEN 1 ELSE 0 END

- Then I applied a Sum to the table calculation

Rapid Check Formula:

IIF([Status Changed To Hold Auth At] > [Asset Checked In At],

DATEDIFF('minute',[Asset Checked In At],[Status Changed To Hold Auth At]),Null)/60

picture:

Why am I getting a 2, not a 1?  I'm so confused!