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: 
AlexJohnsyn
Contributor II
Contributor II

Show last 6 months data on chart

Hello,

I'm trying to restrict a chart to only show the last 3 months data. I have a simple sum of '$amount' as the expression. This is shown by date (using a master calendar) showing only MM-YYYY 'monthyear_date'. 

I would like to restrict the dimension to show only last 3 months. Any help appreciated.

Labels (2)
1 Solution

Accepted Solutions
sergio0592
Specialist III
Specialist III

Hi, you can avoid AddMonths with :

sum({<Date= {">=$(=monthstart(max(Date),-2))"}>Amount)

View solution in original post

4 Replies
lironbaram
Partner - Master III
Partner - Master III

hi 

you could use something like this 

sum({<Date= {">=$(=addmonths(monthstart(max(Date)),-2))"}>Amount)

AlexJohnsyn
Contributor II
Contributor II
Author

Thank you, I hope I've used this correctly? Because I keep receiving a "allocated memory exceeded" error..

sum({<monthyear_date= {">=$(=addmonths(monthstart(max(monthyear_date)),-2))"}>Amount)

lironbaram
Partner - Master III
Partner - Master III

hi 

it seems ok , 

does the month field and the amount field are in the same table 

if not , how are they connected 

sergio0592
Specialist III
Specialist III

Hi, you can avoid AddMonths with :

sum({<Date= {">=$(=monthstart(max(Date),-2))"}>Amount)