Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
Not applicable

Show todays amount of users and yesterdays amount of users

Hey everyone,

Im trying to create 2 text objects with 2 expressions.

1st. Count the amount of users of today (by using the Today() function).

2nd. Count the amount of users of yesterday (by using the Date(Today()-1) function).

For example:

If I look at the objects today (10-02-2017) I can see 5 users today and the text

object with the amount of users of yesterday shows 6.

Then if I look at the same objects the next day, I want to see the amount of users of that day (11-02-2017)
and the 5 users of yesterday (10-02-2017).

I hope someone can help me out with this problem

Thanks in advance,

Ivo

Tags (3)
1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: Show todays amount of users and yesterdays amount of users

Within my suggestion is a small typo which needs to be corrected - the square bracket must be a curved bracket (which also caused the red-lines by the field User_ID from the syntax-checker):

count({< Date = {"$(=today())"}>} User)

count({< Date = {"$(=date(today()-1))"}>} User)

Beside this make sure that Date is really a date and not a timestamp - if it it needs to be cut with floor() - and that Date has the same formatting as your default date-formatting defined by the variables with which your script starts. If this format is different from Date you need to adjust either this variable or extend the date-function within the set analysis to your needed format, like: date(Date, 'YourDateFormat').

- Marcus

View solution in original post

4 Replies
MVP & Luminary
MVP & Luminary

Re: Show todays amount of users and yesterdays amount of users

You could get it with:

count({< Date = {"$(=today())"}>] User)

count({< Date = {"$(=date(today()-1))"}>] User)

- Marcus

Not applicable

Re: Show todays amount of users and yesterdays amount of users

Hey Marcus,

Thanks for the reply, but both expressions give me a 0 count and I'm totally sure that the logfiles show use on today and yesterday. I also had a problem with the syntax when I copied your lines of expressions.

2017-02-13_7-18-31.png2017-02-13_7-18-57.png

Note: I changed 'User' to 'User_ID', because that is how the User is defined in my tool.

MVP & Luminary
MVP & Luminary

Re: Show todays amount of users and yesterdays amount of users

Within my suggestion is a small typo which needs to be corrected - the square bracket must be a curved bracket (which also caused the red-lines by the field User_ID from the syntax-checker):

count({< Date = {"$(=today())"}>} User)

count({< Date = {"$(=date(today()-1))"}>} User)

Beside this make sure that Date is really a date and not a timestamp - if it it needs to be cut with floor() - and that Date has the same formatting as your default date-formatting defined by the variables with which your script starts. If this format is different from Date you need to adjust either this variable or extend the date-function within the set analysis to your needed format, like: date(Date, 'YourDateFormat').

- Marcus

View solution in original post

Not applicable

Re: Show todays amount of users and yesterdays amount of users

This worked, Thanks!


It was indeed a problem with the timestamp. I changed the date field to a date field that had a normal notation instead of a timestamp notation.