Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
March 11, 2PM EST: Do More with Qlik - Getting Started wtih Qlik Sense SaaS - Redux. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
wesbrowning
Partner
Partner

Help with COUNT of FIELD equal to specific value

Here's what I'm hoping to display in KPI: Count({[Priority] = '3 - Medium'}) 

Field is "Priority" and wanting to count number of times it's equal to "3 - Medium"

I know this is so easy for you folks - hoping someone can clarify this for me.  I'm just starting out (as you can tell)...

1 Solution

Accepted Solutions
OmarBenSalem
Partner
Partner

Hi Wes,

Count(Priority) is the original expression.

Now we do not want to count all that exists in Priority, but only certain values.

To do that we add our condition in a set expression:

1) first step: we  automatically add this (it's a syntax thing):

Count({<>}Priority)

2) Now we will put our condition within it: the [Priority] = '3 - Medium' thing:

Count({<Priority={}>}Priority)


3)Now, depends on the condition, we might add quotes or double quotes;


-Let me explain; if we were working with field Year, and we want to just work with Year 2017, since it's a numeric value:

Year={2017} without quotes


-If we work with a string, let's say country = Tunisia , we surround it with quotes:

Country={'Tunisia'}


-If it's an expression (the max year for example), we surround it by double quotes:

Year= {"max(Year)"}

Now, since it's a calculation; (the max), it's demands a '='; and the '=' demands a '$' sign to return the outcome of the calculation:

Year= {"$(=max(Year))"}


Now, in our case, we work with a string; so our expression will be

from;

Count({<Priority={}>}Priority)

To:

Count({<Priority={'3-Medium'}>}Priority)


Hope that was rather clear

View solution in original post

10 Replies
sarvesh
Creator III
Creator III

Try

=count({<Your Dimension={'Fail'}>} Your Dimension)

=count({<Your Dimension={'Pass'}>} Your Dimension)


or for both


=count({<Your Dimension={'Pass','Fail'}>} Your Dimension)

tresesco
MVP
MVP

Try like:

Count({<[Priority] = {'3 - Medium'}>} [Priority] )

OmarBenSalem
Partner
Partner

Hi Wes,

Count(Priority) is the original expression.

Now we do not want to count all that exists in Priority, but only certain values.

To do that we add our condition in a set expression:

1) first step: we  automatically add this (it's a syntax thing):

Count({<>}Priority)

2) Now we will put our condition within it: the [Priority] = '3 - Medium' thing:

Count({<Priority={}>}Priority)


3)Now, depends on the condition, we might add quotes or double quotes;


-Let me explain; if we were working with field Year, and we want to just work with Year 2017, since it's a numeric value:

Year={2017} without quotes


-If we work with a string, let's say country = Tunisia , we surround it with quotes:

Country={'Tunisia'}


-If it's an expression (the max year for example), we surround it by double quotes:

Year= {"max(Year)"}

Now, since it's a calculation; (the max), it's demands a '='; and the '=' demands a '$' sign to return the outcome of the calculation:

Year= {"$(=max(Year))"}


Now, in our case, we work with a string; so our expression will be

from;

Count({<Priority={}>}Priority)

To:

Count({<Priority={'3-Medium'}>}Priority)


Hope that was rather clear

View solution in original post

wesbrowning
Partner
Partner

Thanks all for the great guidance!  This was exactly what I needed. 

OmarBenSalem
Partner
Partner

Hi Wes, don't forget to close the thread by marking the correct answer as so if your question has been correctly answered.

Have a nice day,

Omar,

diwaskarki
Creator II
Creator II

Thanks for putting it so clearly.

manoranjan_d
Specialist
Specialist

good one omar

manoranjan_d
Specialist
Specialist

omar can you pls expalin the null value in  set analysis like simple easy understandable step by step explanation.

pls

ben_skerrett
Contributor III
Contributor III

OmarBenSalem

Thanks for this post it has been very helpful.

I have a similar issue I am hoping you can help with please.

Instead of priority I want to count the number of entries, where the difference between two dates is greater than 1. Something like:

 

Count({<EndDate-StartDate>{'1'}>}EndDate-StartDate)

Thanks

Ben