Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
mhmmd_srf
Creator II
Creator II

Null Condition in Set Analysis

Hi All,

I have below expression :

Count({$<Req_state={3}>}Req_number). However I want to add one more condition that is Closed Date = null.

I am using below script but it is not working.

Count({$<closed_at = {NULL},Req_state={3}>}Req_number)

Could you please help me.

Thanks,

Sarif

13 Replies
harishkumarg
Creator III
Creator III

Hi

Please try something like this,

Count({$<closed_at -= {'*'},Req_state={3}>}Req_number)


Regards

Harish

harishkumarg
Creator III
Creator III

The above wont work. Try something like,

Count({$<Req_state={3}>}Req_number) - Count({$<closed_at -= {"len(trim(closed_at))=0"},Req_state={3}>}Req_number)


Regards

Harish

mhmmd_srf
Creator II
Creator II
Author

Hi Harish,

Both Expressions are not working... please suggest any other approach.

Thanks in advance,

Sarif

swuehl
MVP
MVP

Have a look at

Excluding values in Set Analysis

Set analysis is depending on your sets (i.e. your data model and data), but maybe try something like this if Req_number is like a unique id field:

Count({$<Req_number = e( {< closed_at = {"*"} >} ), Req_state={3}>}Req_number)

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Null values in a certain cannot be selected - not by inclusion, and not by exclusion (AFAIK).

The trick is to select values in another field that are associated with the NULL values in your field.

For example, the following three versions won't work:

closed_at = {NULL},

closed_at -= {'*'},

closed_at = {"=len(trim(closed_at))=0"}


while the following should return the desired:


Count({$<Req_number -= {"len(trim(closed_at))=0"},Req_state={3}>}Req_number)


In this expression, you are selecting (or rather excluding) Req_Number values that are associated with the NULL values in closed_at.


cheers,

Oleg Troyansky

Learn advanced QlikView and Qlik Sense techniques in my book QlikView Your Business.

mhmmd_srf
Creator II
Creator II
Author

Do we need to create any field called Req_number? If yes then what would be the expression?


Please suggest.

Thanks

Sarif

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Mohammad,

Req number is the field you used in your original formula:

Count({$<closed_at = {NULL},Req_state={3}>}Req_number)

There is no need in creating new fields. The point is that instead of selecting NULL values in the field closed_at, you should be selecting values of another field that is associated with closed_at.

hope it helps,

Oleg Troyansky

Anonymous
Not applicable

Hi Mohammad,

requesting you to use following for adding null values of closed_at field.

Count({$<closed_at = {"=Len(City)=0"},Req_state={3}>}Req_number)


Thanks,


Anonymous
Not applicable

Hi Mohammad,

just correcting my  above expression,requesting you to use following for adding null values of closed_at field.

Count({$<closed_at = {"=Len(closed_at)=0"},Req_state={3}>}Req_number)


Thanks,