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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to compare the days differnece between 2 dates with number?

I have 2 date fields A & B lets say,

=Count({$<Interval(date(A)-date(B))= {'$(<=10)'}>}  ID )

please correct it, because it is giving me "ERROR IN SET EXPRESSION" at RED BRACE

6 Replies
ahaahaaha
Partner - Master
Partner - Master

May be

=Count({$<ID={"=Num(A)-Num(B)<=10"}>}  ID )

Anonymous
Not applicable
Author

If you dont have the result of the Interval(Date(A)-Date(B) as a field, id suggest using count if.

Count(if(Interval(DateA-DateB)<=10,ID))

Set Analysis does not work with calculations. Unless you try create a variable for the calculation.

LET vVariable = Interval(Date(A)-Date(B))

Then Using set analysis .

Count({$<vVariable={"<=$(=10)"}>}ID)



Not applicable
Author

Thanks Ruan.

Its works.

But what I want to do is , I have to put some AND conditions,

=Count(If(Date(A) - Date(B) <= Day(10)

and(Status_Field='Complete' or Status_Field='Failed')

and (not IsNull(field2) or field2<>  0), ID))

Anonymous
Not applicable
Author

Thats simple enough.

Count(If(Date(A)-Date(B) <= 10 and Match(Status_Field,'Complete','Failed') and NOT isnull(Field) or Field2 <>0,ID)))

Just check the brackets.  But that should be fine.

Not applicable
Author

Thanks once again.

But count is not matching , I will recheck my reference count.

Thanks!

Regards,

Shubham

avinashelite

Try like this

Count(If(Date(A)-Date(B) <= 10 and Match(Status_Field,'Complete','Failed') and (len(Field)>0 or Field2 <>0,ID)))