Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Giselle100
Contributor III
Contributor III

Returning last 7 days of data

Hi there

I have the below expression

Count({<[Status]={8} >}distinct [Order No] )

How do I amend it to only return the data for the last 7 days?

 

Labels (2)
9 Replies
sunny_talwar

May be something like this

Count({<[Status] = {8}, DateField = {"$(='>=' & Date(Today() - 7, 'DateFieldFormatHere'))"}>} DISTINCT [Order No])
Giselle100
Contributor III
Contributor III
Author

Its returning a zero value
sunny_talwar

What was the exact expression you used? Did you replace DateFieldFormatHere with the format of your date field?
Giselle100
Contributor III
Contributor III
Author

Count({<[Status] = {8}, [Outscan Date] = {"$(='>=' & Date(Today() - 7, 'YYYY/MM/DD'))"}>} DISTINCT [Order No])

sunny_talwar

The expression looks good... are you looking for last 7 days from today or last 7 days from the max date in the database?
Giselle100
Contributor III
Contributor III
Author

max date

sunny_talwar

Then try this

Count({<[Status] = {8}, [Outscan Date] = {"$(='>=' & Date(Max([Outscan Date]) - 7, 'YYYY/MM/DD'))"}>} DISTINCT [Order No])
Giselle100
Contributor III
Contributor III
Author

Still returning a zero value

sunny_talwar

Would you be able to share a sample to check this out?