Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Limiting the months on a graph

Hi There,

I am trying to limit my bar chart to show only the last three months instead of all months.

Is there a simple peice of code I can use that will do this automatically?

My graph currently shows sales figures for Feb,Mar,Apr,May,Jun.

I would like it to only show Apr, May, Jun and when it brings in July figures in July I would like it to drop Apr and just show May,Jun,Jul.

Is this possible?

In the attachment below I have shown what it currently looks like. The dimension is Month/Year.

Would greatly appriciate the help.

Thanks

1 Solution

Accepted Solutions
narender123
Specialist
Specialist

I set analysis.

Month={'>=$(=max(Month)-2)'}

Thanks.

Narender

View solution in original post

5 Replies
pennetzdorfer
Creator III
Creator III

This blog post of Henric Conström will help you out:

http://community.qlik.com/blogs/qlikviewdesignblog/2013/06/10/relative-calendar-fields

The clue is creating a new field (MonthAgo) in the script and using it in your expression (set analysis).

Regards,

Florian

narender123
Specialist
Specialist

I set analysis.

Month={'>=$(=max(Month)-2)'}

Thanks.

Narender

narender123
Specialist
Specialist

I set analysis.

Month={'>=$(=max(Month)-2)'}

Thanks.

Narender

er_mohit
Master II
Master II

try this

Sum({<Month = {">=$(=max(Month)-2)"}>}sales)

Not applicable
Author

That's brilliant thanks everyone for your help, the set is working.

Much appriciated.