Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

count today - 7 days

Hi all

I have the following fields:

Date

Activity_id

I also have a table chart with the following expression: count(Activities_id).

I want to count (Activities_id) using set analysis, so that I'll count all the activities which were performed 7 days ago till today.

I'm not sure how I can do that... I'm using the following expression in order to count last week activities:

=count

(DISTINCT

  {$<[YearWeek_Num] = {$(=MAX([YearWeek_Num])-1)}>}

  [Activities_id]

)

can someone please advise?

thanks!

1 Solution

Accepted Solutions
nikhilgandhi715
Contributor III
Contributor III

Hi Michal,

Please try below expression.

 

=

count({<Date={">=$(=date(today()-7))<=$(=date(today()))"}>} Activity_id)

View solution in original post

11 Replies
alexandros17
Partner - Champion III
Partner - Champion III

I should do:

count

(DISTINCT

  {$<[YearWeek_Num] = {$(=(year(Today()-7)*100+week(today()-7)))}>}

  [Activities_id]

)

Anonymous
Not applicable
Author

Assuming that the field names are Date and Activity_id, this will work:

count({<Date={">=date(today()-7)<=date(today()"}>} distinct Activity_id)

sgrice
Partner - Creator II
Partner - Creator II

count({<Date={">=date(today()-7)<=date(today())"}>} distinct Activity_id)

U missed a Bracket

Anonymous
Not applicable
Author

thanks

Not applicable
Author

Hi! thank you for your help.

for some reason the result is '0' although I have activities in the last 7 days

please check the attached example...

thanks

nikhilgandhi715
Contributor III
Contributor III

Hi Michal,

Please try below expression.

 

=

count({<Date={">=$(=date(today()-7))<=$(=date(today()))"}>} Activity_id)

Anonymous
Not applicable
Author

OK, here is a more reliable way:

=count({<Date={"$(='>='&date(today()-7)&'<='&date(today()))"}>} distinct Activity_id)

krishna20
Specialist II
Specialist II

Hi,

Michal

Try this

=count({<Date={"=date(today()-7)"}>} distinct Activity_id)

MayilVahanan

Hi

Try like this

count({<Date={">=$(=date(today()-7))<=$(=date(today()))"}>} distinct Activity_id)



Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.