Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

udaya_kumar
Valued Contributor

how to show latest 24 months of data in chart?

Hi,

I have a date field in the chart as x-axis.

Currently am showing 72 months of data, the full data.

now i want to show only latest 24 months of data in the x-axis in the chart.

how we can do that?

Tags (2)
1 Solution

Accepted Solutions
jason_michaelid
Honored Contributor II

Re: how to show latest 24 months of data in chart?

You could just use a variable in the dimension limits box.  Have a variable vDateRange set by a checkbox/inputbox and put vDateRange into the dimension limits section.

12 Replies
jason_michaelid
Honored Contributor II

Re: how to show latest 24 months of data in chart?

Use set analysis.  Say your current expression is Sum(Sales).  Instead, try:

Sum({<Date={">=$(=AddMonths(Max(Date),-24))"}>} Sales)

Hope this helps,

Jason

jason_michaelid
Honored Contributor II

Re: how to show latest 24 months of data in chart?

(Or if you are using verson 11 then use dimension limits.)

udaya_kumar
Valued Contributor

Re: how to show latest 24 months of data in chart?

Hi Jason,

I am using qlikview 11, so it works.

but i want to show 72 months data in the same chart also.

By default, i should show 24months data, and i have a checkbox,

clicking on checkbox, it should show full 72 months data.

This is the problem.

jason_michaelid
Honored Contributor II

Re: how to show latest 24 months of data in chart?

You could just use a variable in the dimension limits box.  Have a variable vDateRange set by a checkbox/inputbox and put vDateRange into the dimension limits section.

udaya_kumar
Valued Contributor

Re: how to show latest 24 months of data in chart?

Hi Jason,


Thanks for the answer, it works fine,

but how can i do this for pivot table?

In Pivot table, dimension limit tab is not there.

Please help.

jason_michaelid
Honored Contributor II

Re: how to show latest 24 months of data in chart?

I think you'll need to use my expression suggestion above, replacing -24 with vDateRange.

udaya_kumar
Valued Contributor

Re: how to show latest 24 months of data in chart?

Jason,


I need to use my field in place of Date in the above expression right?

I use it like that, but i didnt get the result.

udaya_kumar
Valued Contributor

Re: how to show latest 24 months of data in chart?

Jason,

My Date field is of MMM YYYY format, but i checked this expression

(=AddMonths(Max(Date),-24))

I am getting 5/1/2012

but the data for month, I converted that into May 2012 format.

Is this creating problem for that?

jason_michaelid
Honored Contributor II

Re: how to show latest 24 months of data in chart?

Try:

Sum({<Date={">=$(=Date(AddMonths(Max(Date),-24),'MMM YYYY')"}>} Sales)

Community Browser