Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get customer count based on range of dates?

Hi,

I have fields Owner, CustomerId, EnterDate. Based on this EnterDate I need to calculate count(CustomerId)

I,e

Dimension: Owner

Expression: Count(CustomerId) when EnterDate between last monday to current Monday I,e from 08/09/2014 to 15/09/2014

Can anyone please help me with expression. As I can see this with selection of list box but user don't want to select in list box.

Thanks.

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

=SUM({<[Invoice Date] = {'>=$(=Date(WeekStart(Today())-7))<=$(=Date(WeekStart(Today())))'}>}Amount)

1) Change FieldName Accordingly

2) Also, if instead of Today(), you want Previous Week Monday to Selected Date Monday,

Replace Today() with Max([Invoice Date])

View solution in original post

8 Replies
MK_QSL
MVP
MVP

=SUM({<[Invoice Date] = {'>=$(=Date(WeekStart(Today())-7))<=$(=Date(WeekStart(Today())))'}>}Amount)

1) Change FieldName Accordingly

2) Also, if instead of Today(), you want Previous Week Monday to Selected Date Monday,

Replace Today() with Max([Invoice Date])

Not applicable
Author

hi

try this

=count({<EnterDate = {'>=$(=Date(WeekStart(Today())-7))<=$(=Date(WeekStart(Today())))'}>}CustomerId)

MK_QSL
MVP
MVP

I have used SUM(Amout).... as Vishwaranjan said, you can change as COUNT(CustomerID)

Not applicable
Author

Thanks.

Not applicable
Author

Thanks

Not applicable
Author

How can I change the same expression if I want to include the same condition but with

CustomerStatus='Fail1'

Please help

MK_QSL
MVP
MVP

=COUNT({<CustomerStatus = {'Fail1'},[Invoice Date] = {'>=$(=Date(WeekStart(Today())-7))<=$(=Date(WeekStart(Today())))'}>}CustomerId)

Not applicable
Author

Great Thanks.