Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Applicable88
Creator III
Creator III

Several Condition in Set Analysis

Hello,

both condition work on their own but not together:

OrdersEntryDateDeliveryDate
1234409.09.202015.10.2020
1234510.09.202015.10.2020
1234611.09.202021.10.2020
1234712.09.2020-
1234813.09.2020-
1234914.09.2020-

count({1<[EntryDate]={"<=$(=Date(today()-30))"},[DeliveryDate]={">$(=Date(0))">} distinct Order)

The first condition is "all Orders older than 30 days" and the sencond condition is "where there is NO delivery Date given" 

Since the product can be arrived, but maybe not yet dispatched. So I have null() values there. EntryDates are always present. 

Each work on their own, but not combined. Is the null the probleme? I also tried many different null() functions, and I need to count the Orders which is older than 30 Days but still in iventory. 

Hope someone knows a solution.

Best. 

2 Solutions

Accepted Solutions
marcus_sommer

NULL couldn't be directly queried within a set analysis but you could try to reverse the logic like:

count({1<[EntryDate]={"<=$(=today()-30)"},[DeliveryDate] -= {"*"}>} distinct Orders)

Not uncommon is also to set real values for these missing ones within the script. Depending on the requirements it may be 0 or today() or makedate(9999,12, 31) or maybe simply 'no date', for example with:

if(len(trim([DeliveryDate])), 'no date', [DeliveryDate]) as [DeliveryDate]

- Marcus

View solution in original post

Applicable88
Creator III
Creator III
Author

Hello @marcus_sommer,

thank you very much for your help.  The  reversing the logic "-=" isn't working as well.  I get no return. Set Expression is a very great tool.

But there are sometimes difficutlies when someone want to work with null values. Even if isNULL function and nullcount() function might count different in the "background", depending on Datatype, there is a big difference in the Syntax I just realized.

The is Null Syntax: IsNull(expr )

The Nullcount Syntax : NullCount({[SetExpression][DISTINCT] [TOTAL [<fld {,fld}>]]} expr)

With the Nullcount() I can do structures like this:

nullcount({1<[EntryDate]={"<$(=Date(today()-30))"}>}DeliveryDate)

The advantage for a use in a KPI Windows would be the possible use of identifiers. Which no If-statment provides. 

I conclude the best would be to follow your advise and to already "fix" problems in the load script or even DataWarehouse.

Thank you very much. 

 

View solution in original post

6 Replies
marcus_sommer

There is a missing curly bracket by the second condition - therefore you may try:

count({1<[EntryDate]={"<=$(=today()-30)"},[DeliveryDate]={'*'}>} distinct Order)

- Marcus

Applicable88
Creator III
Creator III
Author

Hi @marcus_sommer ,

I tried as you said. I also tried with the {*} instead of date(0), still getting Null in a KPI window. 

Best.

marcus_sommer

Do you use {*} or {'*'}. Further I noticed in your table the counting-field is Orders and in expression is Order - is it spelled correctly?

- Marcus

Applicable88
Creator III
Creator III
Author

Hi, @marcus_sommer ,

I get a return now. The asterix apprarently needed double quote {"*"} to work. With single quotes I get no return. 

Maybe I didn't put my question well enough, but I acutally wanted the all counts, where I have a date in the first column but Null in deliveryDate.  Is there another way than using isNull()? In the sample table I showed it means, count where entrydate is given but no deliverydate given. 

Best. 

marcus_sommer

NULL couldn't be directly queried within a set analysis but you could try to reverse the logic like:

count({1<[EntryDate]={"<=$(=today()-30)"},[DeliveryDate] -= {"*"}>} distinct Orders)

Not uncommon is also to set real values for these missing ones within the script. Depending on the requirements it may be 0 or today() or makedate(9999,12, 31) or maybe simply 'no date', for example with:

if(len(trim([DeliveryDate])), 'no date', [DeliveryDate]) as [DeliveryDate]

- Marcus

Applicable88
Creator III
Creator III
Author

Hello @marcus_sommer,

thank you very much for your help.  The  reversing the logic "-=" isn't working as well.  I get no return. Set Expression is a very great tool.

But there are sometimes difficutlies when someone want to work with null values. Even if isNULL function and nullcount() function might count different in the "background", depending on Datatype, there is a big difference in the Syntax I just realized.

The is Null Syntax: IsNull(expr )

The Nullcount Syntax : NullCount({[SetExpression][DISTINCT] [TOTAL [<fld {,fld}>]]} expr)

With the Nullcount() I can do structures like this:

nullcount({1<[EntryDate]={"<$(=Date(today()-30))"}>}DeliveryDate)

The advantage for a use in a KPI Windows would be the possible use of identifiers. Which no If-statment provides. 

I conclude the best would be to follow your advise and to already "fix" problems in the load script or even DataWarehouse.

Thank you very much.