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

Comparing one field with two variables in set analysis

Hi, I'm having trouble with this formula:

COUNT({<SomeOtherDate={"$(='>=' & Min(Date) & '<=' & Max(Date)"}>} apples)

It filters Min(Date) correctly, but doesn't include Max(Date) in calculation as the comparison operator was '<'.

For example, formula COUNT({<SomeOtherDate={"$(='>=' '2020-09-01') & '<=' & '2020-09-30'"}>} apples)

would include dates 2020-09-01 to 2020-09-29. I want my 2020-09-30 in.

Can somebody help with this issue? 

1 Solution

Accepted Solutions
Vegar
MVP
MVP

Are you sure that your datamodel hold data for SomeOtherDate = 2020-09-30? If so then make sure that the SomeOtherDate is in fact a date and note a timestamp that holds an decimal value as well?

You could try this expression expanding the interval to the end of the date '2020-09-30 23:59:59'.

 COUNT({<SomeOtherDate={"$(='>=' & Min(Date) & '<=' & Max(dayend(Date))"}>} apples)

View solution in original post

3 Replies
Vegar
MVP
MVP

Are you sure that your datamodel hold data for SomeOtherDate = 2020-09-30? If so then make sure that the SomeOtherDate is in fact a date and note a timestamp that holds an decimal value as well?

You could try this expression expanding the interval to the end of the date '2020-09-30 23:59:59'.

 COUNT({<SomeOtherDate={"$(='>=' & Min(Date) & '<=' & Max(dayend(Date))"}>} apples)

edwin
Master II
Master II

try this:

COUNT({<SomeOtherDate={"$(=>2020-09-01<=2020-09-30"}>} apples)

COUNT({<SomeOtherDate={"$(=>$(=min(otherdate))<=$(=max(otherdate))"}>} apples)

 

 

qliknonsense
Contributor
Contributor
Author

Floor function solved the problem, thank you 🙂