Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression is yielding wrong result

The following two expressions yield the same result:

  1. Count ( Shipments)
  2. Count ( if ( FeeOne >0 , Shipments , 0 ) )

However, there are values present in the data set in which FeeOne is <=0. I tried turning off ‘Suppress Zero-Values’ in the ‘Presentation’ tab, to no avail. Expression #2 (above) should equal a number less than Expression #1 (above).

The end result should be two expressions similar to the following, where one expression will equal the total number of shipments with a FeeOne>0 and the other will equal the total number of shipments with a FeeOne <=0.

  1. Count ( if (FeeOne >0, Shipments, 0 ) )
  2. Count ( if (FeeOne >0, 0 ,Shipments ) )

OR

  1. Count({$<FeeOne = {'>0'}>}Shipments
  2. Count({$<FeeOne = {'<=0'}>}Shipments

None of the above examples are working. For syntax purposes, please note that the two expressions will be used in a stacked bar graph. Can anyone help?

1 Solution

Accepted Solutions
swuehl
MVP
MVP

0 (zero) is a value and will count for the count()

You need to use

=count(if(FeeOne >0,Shipments))

i.e. if FeeOne is <=0, NULL is returned, which doesn't count for the count()

edit:

If you need to count the records with NULL, try Nullcount(Shipments)

View solution in original post

1 Reply
swuehl
MVP
MVP

0 (zero) is a value and will count for the count()

You need to use

=count(if(FeeOne >0,Shipments))

i.e. if FeeOne is <=0, NULL is returned, which doesn't count for the count()

edit:

If you need to count the records with NULL, try Nullcount(Shipments)