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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Month Sorting Issue

Hi Everyone,

I have a [cons_month] field in which there are 15th no means ( 1 to 15 ) from 1 to 12 means Jan to Dec month and greater than 12 means Supplementary month (Supp_month) for this i wrote following script

if([Cons Month] = 1,'Jan',

        if([Cons Month] = 2,'Feb' ,

         if([Cons Month] = 3,'Mar' ,

          if([Cons Month] = 4,'Apr',

           if([Cons Month] = 5,'May',

            if([Cons Month] = 6,'Jun',

             if([Cons Month] = 7,'Jul',

              if([Cons Month] = 8,'Aug',

               if([Cons Month] = 9,'Sep',

                if([Cons Month] = 10,'Oct',

                 if([Cons Month] = 11,'Nov',

                  if([Cons Month] = 12,'Dec',

                   if([Cons Month] >12,'Sup_month'))))))))))))) as FactMonth,

This is working fine but when we short this month then its not giving proper ordering of month when we short through

sort tab - load original order then its giving proper order but Dec month is coming before Nov month . like below-

Supp_month, apr, may, jun, jul, aug, sep, oct, dec, nov, jan, feb, mar.

I'm not getting why its coming like that .

Please anyone give me some idea.

Thanks

13 Replies
Anonymous
Not applicable
Author

Hi padmanabhan,

Thanks for the reply in sort tab in expression when we pass [Cons month] its working fine but month order is showing jan ....................dec but I want apr to mar.

Thanks

padmanabhan_ram
Creator II
Creator II

Hi Dhiraj,

Please create an Inline table like below

Load * Inline [

number,Month

04, Apr

05, May

06, Jun

07, Jul

08, Aug

09, Sep

10, Oct

11, Nov

12, Dec

01,Jan

02,Feb

03,Mar

];

and use the field Month or number in the expression instead of [Cons Month].

Note: Please make sure the number and Month data are same in the if statement that you are creating i.e. 04,Apr.

Not applicable
Author

Hi Dhiraj,

Create One sortorder field and use the same in Sorting Expression

PFA

Not applicable
Author

HI dheraj,

You need to follow the same thing

just start with apr

You are doing it correctly

Thanks

S shrivas