Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

chrisallen
New Contributor

Qlik Sense count rows within last week

Hi all,

I am trying to make a KPI to count the number of errors occurring in the last week (InputType = Error). I thought this would be simple but I am having far more trouble than I should with it. I have been trying to use variations of =Count({<InputType = {'Error'}, Date = {'>=(Today()-7)'} >} InputType).


I have a feeling it not working may be due to different date formats, but I cannot get anything to work, even when trying to use date() and similar to convert the dates. It only seems to be summing Errors from all time and ignoring the date range.


DateVersionSiteErrorInputType
2017-12-092.5AAAThings brokeError
2017-12-092.3SSS0.74Stat
2017-12-072.3BBB0.65Stat
2017-11-312.1AAASomething went wrongError


Any help would be much appreciated.

Thanks


1 Solution

Accepted Solutions

Re: Qlik Sense count rows within last week

Try this out

=Count({<InputType = {'Error'}, Date = {">=$(=Date(Today()-7, 'YYYY-MM-DD'))"}>} InputType).

7 Replies

Re: Qlik Sense count rows within last week

Try this out

=Count({<InputType = {'Error'}, Date = {">=$(=Date(Today()-7, 'YYYY-MM-DD'))"}>} InputType).

jonvitale
Contributor III

Re: Qlik Sense count rows within last week

Chris,

I suggest working this out step-by-step. You have a nice little table there. Try adding a measure to it: IF(Date > Today() - 7, 1, 0). Work out from there.

You may also want consider creating an extra field called DateNum, which would be Num(Date). This might make it easier to do comparisons.

Finally, in your load script, make sure that your DateFormat is 'YYYY-MM-DD'. It's not the default.

chrisallen
New Contributor

Re: Qlik Sense count rows within last week

Ohhh that's how you convert the date.

Thank you very much, works perfrectly

jonvitale
Contributor III

Re: Qlik Sense count rows within last week

Sunny, how's anyone suppose to get points around here with you answering all the questions?

chrisallen
New Contributor

Re: Qlik Sense count rows within last week

Thank you for that, I think that would be a good practice to start and a good method to try things

YoussefBelloum
Esteemed Contributor

Re: Qlik Sense count rows within last week

Hi,

you can try this:


=Count({<InputType = {'Error'}, Date ={"$(= '>=' &date(today()-7))"} >} InputType)

Re: Qlik Sense count rows within last week

I am done for the day

Community Browser