Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Show values for the past months

Hi there,


I'm stuck on something which seems to be quite simple... Appreciate your help with the requirements below:

How to show values prior to the current month in bar chart? If the current month is Oct, I only want to see values for the past nine month.

Thanks,

WY

2 Replies
tresesco
Not applicable

Re: Show values for the past months

Solution would depend on your data, specially the date field. Try to share a sample qvw with sample data set so that we can provide you the solution accordingly.

willbleksem
Not applicable

Re: Show values for the past months

Hi There,

What you are looking for is what is called a 'Point in Time Comparison'. You Achieve this through Set Analysis. Follow the below thread for understanding:

https://community.qlik.com/thread/109172

What you then have to do is create seven other statements in your set analysis for the pother months (as this comparison already has 2). As an example, it would be something like this:

let v2MonthsAgo = '=month(addmonths(max(Date),-2))';

let v3MonthsAgo = '=month(addmonths(max(Date),-3))';

let v4MonthsAgo = '=month(addmonths(max(Date),-4))';

let v5MonthsAgo = '=month(addmonths(max(Date),-5))';

let v6MonthsAgo............etc.

let v7MonthsAgo..............etc.

let v8MonthsAgo...........etc.

let v9MonthsAgo............etc.



You then substitute these variables into your 'Prior Month' expression for each month.

I hope this helps!