10 Replies Latest reply on Jul 26, 2016 8:08 AM by Rohit Kumar

# Countif function in Tableau

Hi,

I'm a new Tableau user and I'm wondering whether someone can help me with an excel countif formula in Tableau.  I have 3 columns one with the employee number and another with the Manager ID number.  I have a third column that identifies whether an employee is a people manager. What I would like to do is identify those employees that are people managers how many employees that they have reporting up to them. So the number of time their employee number shows up in the Manager ID column.  Is someone able to help me with that formula.

The excel formula I was using is =countif(B:B, A2)   where column B is the Manager ID and column A is the employee number

Thanks and much appreciated

• ###### 1. Re: Countif function in Tableau

There is no Countif, but you can use COUNT and IF in a nested form to get the result you are looking for. Can you post your Excel data?

• ###### 2. Re: Countif function in Tableau

Yes I most certainly can, here is an example of a data file

• ###### 3. Re: Countif function in Tableau

Please clarify the following....What is the relationship between Column A and B?

Column A shows an Employee Number.

Does Column B show the Manager ID they are reporting to when they are not a People Manager?

Trying to understand what/how you are counting.

• ###### 4. Re: Countif function in Tableau

Column A would have all of the employee ID's, Column B shows the Column A's manager ID #, so if an employee is a manager his/her employee Id will show up beside the employees reporting up to them. so if I am employee 222222 and I have an employee reporting to me who's employee ID is 333333 then my employee Id 222222 will show up in column B beside employee 333333.  Hope this is clear, let me know if not.

• ###### 5. Re: Countif function in Tableau

Ok, please check the following numbers:

Direct Report Count is a calculated field that uses the following calculation

COUNT(IF [People Manager] = 'Y' THEN [Employee Number] ELSE 0 END)

Is this what you are trying to accomplish?

• ###### 6. Re: Countif function in Tableau

Thank you so very much, that is it exactly.  You are amazing, once again thanks so much.

• ###### 9. Re: Countif function in Tableau

Hi,

Just we can give   COUNT([People Manager])

• ###### 10. Re: Countif function in Tableau

Hi,

Just we can give   COUNT([People Manager])