Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
udaya_kumar
Specialist
Specialist

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?

1 Solution

Accepted Solutions
Jason_Michaelides
Luminary Alumni
Luminary Alumni

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.

View solution in original post

12 Replies
Jason_Michaelides
Luminary Alumni
Luminary Alumni

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

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

Hope this helps,

Jason

Jason_Michaelides
Luminary Alumni
Luminary Alumni

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

udaya_kumar
Specialist
Specialist
Author

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_Michaelides
Luminary Alumni
Luminary Alumni

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
Specialist
Specialist
Author

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_Michaelides
Luminary Alumni
Luminary Alumni

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

udaya_kumar
Specialist
Specialist
Author

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
Specialist
Specialist
Author

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_Michaelides
Luminary Alumni
Luminary Alumni

Try:

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