Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

jkonicki
New Contributor II

Count with multiple conditions?

Hi there,

I'm trying to utilize a count that has multiple conditions attached to it. The conditions are composed like this:

1. The Expiration date <> 0 or null

2. Today's date must be greater than or equal to the Expiration date.

If both of these are fulfilled, then it should count the field named RTC_TITLE.This is what I have so far:

Count({$<CERTIFICATION_EXPIRATION_DATE= {"<>0"}, vToday >= "CERTIFICATION_EXPIRATION_DATE">} RTC_TITLE)

I keep getting an error from this though. What am I doing incorrectly that would throw an error? Any help is appreciated.

Thanks!

1 Solution

Accepted Solutions
nakul1001
Contributor II

Re: Count with multiple conditions?

Hi Jordan,

Could you try this:

count( {$<CERTIFICATION_EXPIRATION_DATE -= {''}, CERTIFICATION_EXPIRATION_DATE -= {0} , CERTIFICATION_EXPIRATION_DATE = {"<=$(=(today()))"}>} RTC_TITLE)

Filtering Null value my be tricky sometimes and the above syntax can actually be simplified further by including all  (*) and then excluding the ones you don't need:-

count( {$<CERTIFICATION_EXPIRATION_DATE = {*} - {'',0,"<=$(=(today()))"}>} RTC_TITLE)

Thanks

Nakul

3 Replies
nakul1001
Contributor II

Re: Count with multiple conditions?

Hi Jordan,

Could you try this:

count( {$<CERTIFICATION_EXPIRATION_DATE -= {''}, CERTIFICATION_EXPIRATION_DATE -= {0} , CERTIFICATION_EXPIRATION_DATE = {"<=$(=(today()))"}>} RTC_TITLE)

Filtering Null value my be tricky sometimes and the above syntax can actually be simplified further by including all  (*) and then excluding the ones you don't need:-

count( {$<CERTIFICATION_EXPIRATION_DATE = {*} - {'',0,"<=$(=(today()))"}>} RTC_TITLE)

Thanks

Nakul

jkonicki
New Contributor II

Re: Count with multiple conditions?

Nakul,

I tried both of these and they work perfectly. Thank you so much for your quick response and assistance on this!

-Jordan

jkonicki
New Contributor II

Re: Count with multiple conditions?

I did have another question. I'm trying to add in a mathematical expression as another condition and I'm sure it's just my parentheses, but would this be correct?

Basically I want to do it if the number is between 1 and 30 it's going to count:

((CERTIFICATION_EXPIRATION_DATE - vToday) = {"<=$(=(30()))"}), ((CERTIFICATION_EXPIRATION_DATE - vToday) = {">=$(=(1()))"})>} RTC_TITLE)