Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
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

Labels (1)
2 Replies
tresB
Champion III
Champion III

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.

Anonymous
Not applicable
Author

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!