New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
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
Partner

Re: Help with COUNT of FIELD equal to specific value

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

10 Replies
Highlighted
Contributor III

Try

or for both

Highlighted
MVP

Re: Help with COUNT of FIELD equal to specific value

Try like:

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

Partner

Re: Help with COUNT of FIELD equal to specific value

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

Highlighted
Partner

Re: Help with COUNT of FIELD equal to specific value

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

Highlighted
Partner

Have a nice day,

Omar,

Highlighted
Contributor II

Re: Help with COUNT of FIELD equal to specific value

Thanks for putting it so clearly.

Highlighted
Contributor III

good one omar

Highlighted
Contributor III

Re: Help with COUNT of FIELD equal to specific value

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

pls

Highlighted
New Contributor III

Re: Help with COUNT of FIELD equal to specific value

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