4 Replies Latest reply: Jul 24, 2012 11:16 AM by Jason Zola

# Easy Question on Counting Instances of a Field

Please excuse the simplicity of this question, i am just getting started using Qlikview.   I am trying to count the number of unique employees in a record based on their work group.   I can display the data in a table but i want to get a calculated number of employees so that I can use this value in further productivity calculations.   The number of employees in a group changes on a daily basis due to sick time, vacation, etc.

My data shows employee name, work center, and job type.   Example:

Joe           Meter Shop          HIB199

Joe           Meter Shop          HIB199

Joe           Meter Shop         G34555

Mary          Meter Shop         HIB199

Mary          Meter Shop        JZZRT5

James      Cafeteria             T44WTZ

Tim           Cafeteria              T44WTZ

Laura       Cafeteria              T44WTZ

I need to be able to count the number of different employees in each work center.   So Meter Shop = 2 (Joe and Mary) and Cafeteria = 3 (James, Tim, Laura)

I only need the number of employees in a work center, not the number of jobs they complete or the types of jobs.

Thank you.

• ###### Re: Easy Question on Counting Instances of a Field

HI,

You can use like this,

=WorkCenter as Dimension and Count(Distinct Name) as Expression

Hope it helps

• ###### Re: Easy Question on Counting Instances of a Field

Unfortunately that does not work.  That result is just the number of jobs each tech does.

Using:

Work Center Scheduled as the  Dimension

count([Employee Scheduled])  as the Expression

That will result in 5 for Meter Shop and 3 for Cafeteria.   It just counts the instances in each Work Center Schedule or in this case the number of jobs.

Do i need to add Distinct to my count?   The Employee Scheduled field is unique to each Work Center (ie, an employee can only work in one group) but there can be multiple instances of an employee since they do multiple tasks per day.

• ###### Re: Easy Question on Counting Instances of a Field

Hi,

Use distinct count, that helps to achieve your requirement..

• ###### Re: Easy Question on Counting Instances of a Field

Thank you very much - it worked when i used:

count(Distinct([Employee Scheduled]))