Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
djbloiss
Contributor III
Contributor III

Filter by last 5 dates for Customer Purchases

I am new to Qlikview and have been giving a project someone else cannot figure out.  In this project we already have one field:

sum({$<SO_Closed={1}, [$(=vCalendar&' Year')]=, [$(=vCalendar&' Month')]=, [Transaction Date]=, WEEK_COUNT ={'<=$(vMax_SO_Closed_WeekCount)>$(=vMax_SO_Closed_WeekCount-5)'}>} [Ext sales-net])

VMax_SO_Closed_WeekCount is

=max({$<SO_Closed={1}>} WEEK_COUNT)

You can see above that we are looking for the transaction date of the last 5 weeks from today's date.  However, we need to change this to look at each customer and the last 5 transactions for each customer regardless of what week it is in.  Does anyone have any idea how we can do this in set analysis? or another way if you can think of it?

2 Replies
devarasu07
Master II
Master II

Hi,

have u tried like below

=sum({$<SO_Closed={1}, [$(=vCalendar&' Year')]=, [$(=vCalendar&' Month')]=, WEEK_COUNT =,

[Transaction Date]={">$(=Date(Max([Transaction Date])-5))<=$(=Max([Transaction Date]))"} >} [Ext sales-net])

djbloiss
Contributor III
Contributor III
Author

Devarasu, that doesn't work.  It is just adding up the last 2 transactions oddly enough.