Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

How to count items if there is a condition?

I want to create a bullet gauge the shows what portion of systems are connected.  The CONNECTIVITY field is populated with 'Yes' or 'No'.

I managed to do this by creating an additional field called CONNECT_NUMERIC and populated it with 1's and 0's by putting in this expression:  =if(CONNECTIVITY ='Yes', 1, 0)

In the bullet gauge, my expression is Sum(Connect_Numeric) and I set my max range expression to Count(Connect_Numeric)

This process seems cumbersome.  Is there a way to do this without adding additional fields?  I'd like to write the expressions directly into the gauge options.  I'd also like to be able to do this with multiple conditions.


So consider CONNECTIVITY = 'Yes' and ACTIVE_SYSTEM = 'Yes'

I'd like to do something like the following:

Gauge Data Measures:

Count if CONNECTIVITY = 'Yes' AND if ACTIVE_SYSTEM = 'Yes'

Gauge Presentation Max Range Limit:

Count if ACTIVE_SYSTEM ' 'Yes'


Thanks!







1 Solution

Accepted Solutions
Highlighted
Contributor III
Contributor III

Re: How to count items if there is a condition?

So the AND function was  much simpler than I expected.

Expression:
=sum(if(CONNECTIVITY = 'Yes' and ACTIVE_SYSTEMS = 'Yes', 1, 0))

Max Range:
=sum(if(ACTIVE_SYSTEMS = 'Yes', 1, 0))

View solution in original post

2 Replies
Highlighted
Contributor III
Contributor III

Re: How to count items if there is a condition?

Okay, it looks like the following expression gets me half the way there:

Gauge Data Measures:

=sum(if(Connectivity = 'Yes',1,0))

Gauge Presentation Max Range Limit:

= count (Connectivity)



Now I need to figure out how to use an AND so that I can modify my first statement.

Highlighted
Contributor III
Contributor III

Re: How to count items if there is a condition?

So the AND function was  much simpler than I expected.

Expression:
=sum(if(CONNECTIVITY = 'Yes' and ACTIVE_SYSTEMS = 'Yes', 1, 0))

Max Range:
=sum(if(ACTIVE_SYSTEMS = 'Yes', 1, 0))

View solution in original post