Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

ameydiwanji
New Contributor II

Custom sorting of Dimentions

Hi,

I am facing problem in sorting the dimension. I have monthly data which i want to sort in reverse order on the basis of months. For eg. I have sales data for Nov'16, Dec'16, Jan'17, Feb'17. Now, i want to sort this data in visualization in such a way that Feb'17 should come first for current year followed by Jan'17, Dec'16, Nov'16.

Can you guys help me??

9 Replies
sureshqv
Esteemed Contributor III

Re: Custom sorting of Dimentions

Hi

Is your [Month/Year] field a date field or text? If it is a date field then you can do a numeric value sort by descending  order. If it is text than you can put this as your sort order in the expression:

=Match([Month/Year], 'Feb-17', 'Dec-16', 'Nov-16')

sureshqv
Esteemed Contributor III

Re: Custom sorting of Dimentions

Mean while check this for better u.standing

Month/Year date field in date sort order

srivastava_sarv
Contributor III

Re: Custom sorting of Dimentions

Hi..Amey,

Try this


If(Customer='$(vFocusCustomer)', 0, 1)

If(Customer='$(vFocusCustomer)', 0, Rank(Sum(Value)))

vinieme12
Esteemed Contributor II

Re: Custom sorting of Dimentions

OR you can create a custom SortORder by loading an inline table associated with the field you want to sort

and then sort by expression

For example

SortMonths:

Load * Inline [

MONTH,Month_SortOrder

Dec,6

Nov,5

Oct,4

etc.............];

Now sort by expression Month_SortOrder

ameydiwanji
New Contributor II

Re: Custom sorting of Dimentions

Thanks a lot for the suggestion but still it is not solved.  I tried this but still the result is coming as Dec'16 first followed by Feb'17, Jan'17 and Nov'16

lech_miszkiewic
Honored Contributor III

Re: Custom sorting of Dimentions

hI,

There are few options you can do

  • Load data in the order you want to show it and on sorting page disable all options (that will default to load order)
  • You can also sort data during load and create dual values for each of them - see this topis as i have explained it in details (your case will be looking at months and attached example is for weeks - but concept is the same).
  • Time Sequence in line chart not in correct order
  • I would suggest converting your text dates to actual dates (numbers with date formatting) - then you will get more flexibility, and you will be able to sort it numericly

regards

Lech

priyasawant
Contributor

Re: Custom sorting of Dimentions

You can create a inline

Year, Sr No.

Feb'17, 1

Jan'17, 2

Dec'16, 3

Nov'16, 4

and sort by --> expression --> and select the field Sr No

Not applicable

Re: Custom sorting of Dimentions

Why don't you just convert it to a date? date#([Month/Year],'MMM'& chr(39) &'YY') Make sure you check descending order. Does it not work?

Not applicable

Re: Custom sorting of Dimentions

Update: Don't convert in the script - apparently there's a bug! (probably to do with the apostrophe) Do it in the sort order field!