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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
rabbani_sk
Contributor III
Contributor III

how to get last 4 months of data in Pivot table?

Dear all,

User Required only last 4 months of the data in a pivot table?

How to do it in Expression by using set Expression

as well as how to do it in dimension  by using date field???

3 Replies
Not applicable

sum({$<Datefield={">=$(=Date(addmonths(Max(date(today(), 'MMM-YYYY')), -4), 'MMM-YYYY'))}>} Amount)

Not applicable

=sum({<YourDatefield={'>=$(DATE(Monthstart(max(Date),-4)),'DD-MM-YYYY')) <=$(=monthend(max(Date)))'}>}Sales)

Not applicable

try this

sum({<Date={">=$(=AddMonths(makedate(max(year),max(month)),-4))"},year=,month=>}sales)

or try this

sum({<datefield={">=$(=monthstart(max(datefield),-4))<=$(=monthend(max(datefield),-1))"},year=,month=,quarter=>}sales)