Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

apsingh27108
New Contributor

Hi, I'm looking for help with conditional count expression

I have two data columns - EmployeId and EmployeM

I'm looking to get count of all the Employee who are not manager.


Thanks for the help

2 Replies
devarasu07
Honored Contributor II

Re: Hi, I'm looking for help with conditional count expression

Hi,

can u share the mock data and expected results,

u can do multiple way,

1) using set analysis (assume title field contain the employ role desc. u can exclude like below

count(distinct  {$<Title-={'*Manager*'} >EmployeId)

or

Count( distinct {$<EmployeM-={'Manager'}>} EmployeId)


2) conditional if count


3) back end script etc


refer to the sample attached,

Capture.JPG

Thanks

Deva

ericasense
New Contributor III

Re: Hi, I'm looking for help with conditional count expression

You can use the P() function within set analysis to return a sub set of items to filter on

=count({<EmployeId= p( EmployeM)>} distinct EmployeId)


Will return a (distinct) count of employees that are managers. Putting a "-" before the "=" sign will now exclude all the managers.


=count({<EmployeId -= p( EmployeM)>} distinct EmployeId) is probably what you need.


Check out the full documentation for set analysis, if you haven't used it before it's a really powerful tool!

Set analysis and set expressions ‒ QlikView


Erica