Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Applicable88
Creator III
Creator III

If statement for counting values in two days

Hello,

my set analysis for counting the number of orders in two days seems to work:

count([EndterminEck.autoCalendar.Date]={"$(=Date(Today()+2))"}>}Orders)

 

But I need a if-statement here and I put that in:

if(Count([EndterminEck.autoCalendar.Date])='$(=Date(Today()+2))', Orders)

why I get no returns now?

Syntax seems to be right. 

Thanks in advance.

2 Solutions

Accepted Solutions
SerhanKaraer
Creator III
Creator III

Hello Applicable,

Although syntax seems ok, there seems something wrong with your expression.

Try if-block in count function:

count(if([EndterminEck.autoCalendar.Date]='$(=Date(Today()+2))',Orders))

In terms of performance, this expression will be slower than set expression alternative.

View solution in original post

SerhanKaraer
Creator III
Creator III

As far as I understand, this solves your problem:

count(if([EndterminEck.autoCalendar.Date]='$(=Date(Today()+2))' or isnull([EndterminEck.autoCalendar.Date]),Orders))

Better performance solution will be:

1) For null values of [EndterminEck.autoCalendar.Date], you can replace them with some text like '#N/A' in your script.

2) Filter null values in set expression like this:

count({<[EndterminEck.autoCalendar.Date]={"$(=Date(Today()+2))"}+{"#N/A"}>} Orders)

 

View solution in original post

3 Replies
SerhanKaraer
Creator III
Creator III

Hello Applicable,

Although syntax seems ok, there seems something wrong with your expression.

Try if-block in count function:

count(if([EndterminEck.autoCalendar.Date]='$(=Date(Today()+2))',Orders))

In terms of performance, this expression will be slower than set expression alternative.

Applicable88
Creator III
Creator III
Author

Thank you very much, after exchange count and if it seems to count.

I want to add one more attribute, and that is to count also all the orders where there is still no timestamp made.

Since these are still open orders not dispatch yet.

so where to put that  attribute inside what you told me:

count(if([EndterminEck.autoCalendar.Date]='$(=Date(Today()+2))',Orders))

SerhanKaraer
Creator III
Creator III

As far as I understand, this solves your problem:

count(if([EndterminEck.autoCalendar.Date]='$(=Date(Today()+2))' or isnull([EndterminEck.autoCalendar.Date]),Orders))

Better performance solution will be:

1) For null values of [EndterminEck.autoCalendar.Date], you can replace them with some text like '#N/A' in your script.

2) Filter null values in set expression like this:

count({<[EndterminEck.autoCalendar.Date]={"$(=Date(Today()+2))"}+{"#N/A"}>} Orders)