Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Help with Sorting Order for Trailing Twelve Months based on user selection in Qliksense

in Qliksense

Current Month October

TTM ( trailing twelve months)—Since we are in Oct 2017 then it will start from Oct 2017 back to Nov 2016

PTTM (Previous trailing twelve months)--- Since we are in Oct 2017 then it will start from Oct 2016 back to Nov 2015

Set Analysis ( TTM) , there is a field called MonthIndex ( Year*12 +Month) using this field I have subtracted 12 to give me the bucket values of TTM & PTTM

Sum( {<MonthIndex = {"$(='>' & $(vFixedTTM) & '<=' & $(vFixedMonthIndex))"} >} SalesAmount)

Issue or What customer is expecting :

Capture.PNG

If you see above screen shot the line is the issue, in the sorting we can do either January to December or December to January. But customer wants the sorting to be as shown in the table on the left Start from the current month to end of TTM. If Customer picks June then it should start from June to July

Please let me know if you need any additional info

11 Replies
sunny_talwar

Vinay - Would you be able to share a qvf to test it out

pradosh_thakur
Master II
Master II

sort the dimension by Monthindex . use sort by expression?

regards

Pradosh

Learning never stops.
Anonymous
Not applicable
Author

tried but not working

Anonymous
Not applicable
Author

will try rey Sunny and update you

Anonymous
Not applicable
Author

Attached is the sample data

sunny_talwar

What is SalesAmount in the Excel? Full Revenue?>

Anonymous
Not applicable
Author

It just t give you full data for all the months. basically i want to put this data in line chart and if i pick any month sorting should be from that month to back to 12 months . and dimension should be month only not year

sunny_talwar

Try this as your sorting expression

=Max({<MonthIndex = {"$(='>' & $(vFixedTTM) & '<=' & $(vFixedMonthIndex))"}>} MonthYear)

Where I created MonthYear like this

MonthName(Date) as MonthYear

But you might be able to use MonthIndex

Anonymous
Not applicable
Author

let me try that  and i will update you rey