Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Counting number of records with conditional statements

HI everyone,

I have a set of records with two different columns, first column is status of the order and it can be either In-process or Shipped.

Second column has shipped dates. I want to count the number of records which are in process and shipped dates which are before today's date.
I tried to compare dates, and I was getting the correct number but when am trying imply a condition where the order is still "In-process' stage and with the shipped dates earlier than today's date.

Thank you,

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

I wasn't able to get it but I copied the logic from this
Multiple IF statements in expression

and it worked. Thanks everyone for the comments.

View solution in original post

9 Replies
vishsaggi
Champion III
Champion III

Can you share a sample app with some data to look into?

Anonymous
Not applicable
Author

=num(count(if(match(ORDER,'INPROCESS'),ORDER) and Date#('20-02-2017','DD-MM-YYYY')>=[SHIPPED DATE])/(Count([ORDER])) ,'#0.0%')

20-02-2017 is my date of comparison

I'm able to get orders which satisfy the date condition but not the ORDER condition

vishsaggi
Champion III
Champion III

Try this? Is your ORDER value INPROCESS or IN-PROCESS ?

=num(count(if(match(ORDER,'IN-PROCESS') > 0,ORDER) and Date#('20-02-2017','DD-MM-YYYY') >=[SHIPPED DATE])/(Count([ORDER])) ,'#0.0%')

Anonymous
Not applicable
Author

count( {<[SHIPPED DATE] = {">=$(=Date('20-02-2017','DD/MM/YYYY'))" }, ORDER={"INPROCESS")}  > } ORDER )



or


Num (count( {<[SHIPPED DATE] = {">=$(=Date('20-02-2017','DD/MM/YYYY'))" }, ORDER={"INPROCESS")}  > } ORDER /  (Count([ORDER])) ,'#0.0%')

Anonymous
Not applicable
Author

No, it's returning the same answer as earlier and it's Inprocess

vishsaggi
Champion III
Champion III

Can you share your sample to look into?

Anonymous
Not applicable
Author

Have a look at the sample.

Anonymous
Not applicable
Author

I wasn't able to get it but I copied the logic from this
Multiple IF statements in expression

and it worked. Thanks everyone for the comments.

vishsaggi
Champion III
Champion III

Try this? What is your expected output?

= Num(count( if(match(Order,'Inprocess')>0 and Date#('20-02-2017','DD-MM-YYYY')>=[Shipped Date], Order))/Count(Order), '#0.0%')