Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor II
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
Highlighted
Creator II
Creator II

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

View solution in original post

3 Replies
Highlighted
Creator II
Creator II

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

View solution in original post

Highlighted
Contributor II
Contributor II

Nakul,

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

-Jordan

Highlighted
Contributor II
Contributor II

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)