5 Replies Latest reply: Jan 25, 2016 5:26 AM by Sangram Reddy

# How can I limit number of bars in a chart?

HI !

I want to show only the last 12 months in a bar chart. Is it possible?

Best regards,

Ciro.

• ###### Re: How can I limit number of bars in a chart?

You can try using a set analysis expressions to limit the number of months. If you have a date field then you can use something like sum({<MyDate={'>=\$(=MonthStart(Max(MyDate),-11))'}>} Value) to calculate the sum of Value using only the date values from the last 12 months.

If you need more help please post a small Qlik Sense app that illustrates the problem.

• ###### Re: How can I limit number of bars in a chart?

Hi Gysbert!

Thank you for your help.

Best regards,

Ciro.

• ###### Re: How can I limit number of bars in a chart?

Hi CIRO,

You can achieve this by an expression as Gysbert mentioned. There is also an alternative to this which can be easier,

In the properties panel, first sort the dimmenion by Months and then set the limitation dropdown to Fixed number and enter in 12 there. This will curtail the output to just last 12 months.

Thanks,

Sangram.

• ###### Re: How can I limit number of bars in a chart?

Hi Sangram!

Thank you for your help.

Your reply is correct too, bud I don't know how mark it as a correct answer.

Best regards,

Ciro.