Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

genericdriv
New Contributor III

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

Re: Comparing with a constant value

Try this

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

4 Replies

Re: Comparing with a constant value

Try this

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

genericdriv
New Contributor III

Re: Comparing with a constant value

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

Re: Comparing with a constant value

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?

genericdriv
New Contributor III

Re: Comparing with a constant value

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