Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
ptwistp1
Contributor III
Contributor III

Count if AND IF

Good day everyone, I hope this is a simple question.

I am trying to put together some "persona mapping", and one of the tasks is to find out if a resource/employee has a laptop AND a desktop.

We have Equipment_Type as the device type (either desktop, laptop, tablet, etc)
we have Report_Name, which gives us the actual USER IDs.

I have done this in python w/ a simple for x in x type of loop, but i am unable to get this working in Qlik Sense Enterprise for a KPI and/or a table that shows these users w/ both devices. 

i have tried:
count(if(Equipement_type like '*POSTE*' and Equipement_type like '*PORTABLE*',Report_name)) but this will clearly not work because you will not have a "POSTE" and a "PORTABLE" (sorry it's french) at the same time. Poste = desktop, portable = laptop.  

So, in a nutshell, how do we count the number of users who have both a laptop and a desktop assigned to them?

Thanks in advance!

Labels (1)
11 Replies
Mauritz_SA
Partner - Specialist
Partner - Specialist

Hi there

Can you maybe post an example of your data in a table? It just makes it easier to understand.

Regards,

Mauritz

ptwistp1
Contributor III
Contributor III
Author

Sorry my friend, can't do that.

But, if you picture a table,  you have the "Device Column" and a "USER" column...  for example:

Laptop | user 1

Desktop | user 1

Laptop|user 3
Desktop |user 2

Desktop | User 3

so, how many users have a laptop and a desktop? in this example it would be 2..

bharathadde
Creator II
Creator II

Try this one

=Count({<Devicetype={'Desktop'},Devicetype={'Laptop'}>}User)

ptwistp1
Contributor III
Contributor III
Author

Sorry, that didn't do the trick. 

Marcos_rv
Creator II
Creator II

Count({<Devicetype={'Desktop','Laptop'}>}User) 

Marcos_rv
Creator II
Creator II

En español: Yo estoy en contra de esto, otra solucion podria ser:

count(if(wildmatch (Equipement_type ,'*POSTE*' ,'*PORTABLE*' ) >0  ,Report_name ) ) 

saludos!!!!

bharathadde
Creator II
Creator II

=Count( if(WildMatch(Devicetype,'Desktop','Laptop')>=2,User))

rogerpegler
Creator II
Creator II

I think you need the intersection of two sets:

=Count({<Devicetype={'Desktop'}>*<Devicetype={'Laptop'}>}User)

jonathandienst
Partner - Champion III
Partner - Champion III

This is an intersection of the Report_name's that have a POSTE and those that have  PORTABLE:

Count({<Report_name = P({<Equipement_type = {"*POSTE*"}>} Report_name)>
	*<Report_name = P({<Equipement_type = {"*PORTABLE*"}>} Report_name)>} Report_name)
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein