Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
mhmmd_srf
Contributor 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
Contributor III

Re: Null Condition in Set Analysis

Hi

Please try something like this,

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


Regards

Harish

harishkumarg
Contributor III

Re: Null Condition in Set Analysis

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
Contributor II

Re: Null Condition in Set Analysis

Hi Harish,

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

Thanks in advance,

Sarif

MVP
MVP

Re: Null Condition in Set Analysis

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)

MVP & Luminary
MVP & Luminary

Re: Null Condition in Set Analysis

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
Contributor II

Re: Null Condition in Set Analysis

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


Please suggest.

Thanks

Sarif

MVP & Luminary
MVP & Luminary

Re: Null Condition in Set Analysis

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

singhpooja
Contributor III

Re: Null Condition in Set Analysis

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,


singhpooja
Contributor III

Re: Null Condition in Set Analysis

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,