Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Rolling month with out set analysis

Dear Friends,

I have Following Issue That is

I have month Dimension

My Requirement is if i select month it shows last 12 months

i want this to be done by if conditions

5 Replies
Anonymous
Not applicable
Author

This post (http://community.qlik.com/message/299831#299831) has a Rolling 12 month solution that builds up an additional Rolling periods table, linked to the calendar.

Though it uses set analysis in the expressions, these can use if statements instead. Shout if you have a problem with doing that.

Jonathan

Not applicable
Author

hai jonthan,

This is not my requirement

if i select year it shows 12 months

if i select year 2012 and month jan feb it shows last 12 months like 2011 feb to 2012 jan

Anonymous
Not applicable
Author

I have achieved that by:

1. In the script

Creating a new table linked to the calendar that has 12 MonthSort fields.

MonthSort1 runs from 1 to 12

MonthSort2 runs from 2 to 1 ...

MonthSort12 runs from 12 to 11

You can load in the attached spreadsheet (Months worksheet)

2. Setting the following variables (TM stands for Twelve Months. You can't use the numbers 12 at the start of a variable):

Today: Use a Calendar object, though this doesn't work on iPads

TMStart: AddMonths(MonthStart(Today),-11)

TMEnd: Today, or MonthEnd(Today) perhaps

MonthSort: 'MonthSort'&Num(Month(TMStart))

4. Setting Month as the dimension of your chart

5. Adding the TMStart and TMEnd as conditions in your expression. Can do with Set analysis or If statements:

sum({<TransDate={'>=TMStart <=TMEnd'}>} Sales)

... or ...

sum(if(TransDate>='$(TMStart)' AND TransDate<='$(TMEnd)', Sales))

6. Ticking expression on the sort properties and adding the following expression:

=[$(MonthSort)]

This tells the chart to sort by numbers from 12 months ago (if it's April now that will be 5 for May) up to the current month number (4 for April), changing from 12 to 1 at the start of the year.

Jonathan

Not applicable
Author

Hai,

Thanks For Posting Reply But My Req is Different

as u posted here only for current year if i go prv year it was showing Blank

if Possible Please Share Sample Application

Thanks&Regards,

Chandu

Anonymous
Not applicable
Author

Previous calendar year is supported by the expression, e.g. TransDate={'>=TMStart <=TMEnd'}

No sample application. I've provided enough details to build something that took a long time to originally develop.

Jonathan