Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count based on Date

I am trying to wirte an expression that does a count on the field [OwnerID] where the field [Date Termed] falls between the current_date and current_date -7 days.  Ideally I would like if it just did a count on [ownerID] for the prior week.

10 Replies
jerem1234
Specialist II
Specialist II

maybe try this in loadscript:

Date(Date#(DATEFIELD, 'YYYY-MM-DD'), 'MM/DD/YYYY') as NEWDATENAME

and replace DATEFIELD and NEWDATENAME with your fields.

Maybe you want beginning of week for each date too, then do:

Date(Weekstart(Date#(DATEFIELD, 'YYYY-MM-DD')), 'MM/DD/YYYY') as NEWWEEKSTARTNAME

and replace DATEFIELD and NEWWEEKSTARTNAME with your fields.

Then in the expression, do:

=Count({<NEWWEEKSTARTNAME = {"<$(=weekstart(today())), >=$(=weekstart(today()-7))"}>}[OwnerID])