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

Comparing with a constant value

Hi there,

I am trying to figure out how many users have been active in a certain period of time. I can use this to find out the amount of days since their last login:

ceil(Interval(Today()-date([users.last_login], 'DD.MM.YYYY'), 'D'), 1)

But comparing it to a constant (in this case 30, for 30 days) does not yield any results:

count({< {30} = {'>=$(=ceil(Interval(Today()-date([users.last_login], 'DD.MM.YYYY'), 'D'), 1))'}>} DISTINCT users.id)

Any suggestions on what I'm doing wrong?

Thanks

1 Solution

Accepted Solutions
sunny_talwar

Try this

Count({< users.id = {"=Ceil(Today() - [users.last_login], 1) <= 30"}>} DISTINCT users.id)

View solution in original post

4 Replies
sunny_talwar

Try this

Count({< users.id = {"=Ceil(Today() - [users.last_login], 1) <= 30"}>} DISTINCT users.id)

Anonymous
Not applicable
Author

Hi Sunny,

thanks for your answer, it worked.

Could you just explain to me what the statement " users.id  = ..." does?
When and how do you have to use such terms?

Regards

sunny_talwar

user.id =  is a boolean search where the expression only show rows where the expression results as TRUE. To see which rows are included create a straight table and add user.id as dimension and add =Ceil(Today() - [users.last_login], 1) <= 30 as expression.... next, make sure that you have unchecked 'Suppress Zero Values' on the presentation tab and you will see bunch of -1s and 0s against user.id.... All those places where you see -1 are the rows that are included in your expression.... 0 rows are excluded.

Does that make sense?

Anonymous
Not applicable
Author

It does, thanks for the explanation and the help in general!