Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

vinay_bangari
Valued Contributor III

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

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

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

pradosh_thakur
Honored Contributor II

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

sort the dimension by Monthindex . use sort by expression?

regards

Pradosh

Learning never stops.
vinay_bangari
Valued Contributor III

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

tried but not working

vinay_bangari
Valued Contributor III

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

will try rey Sunny and update you

vinay_bangari
Valued Contributor III

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

Attached is the sample data

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

What is SalesAmount in the Excel? Full Revenue?>

vinay_bangari
Valued Contributor III

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

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

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

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

vinay_bangari
Valued Contributor III

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

let me try that  and i will update you rey

Community Browser