Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sorting MonthNames in proper order

Hello all,

I have used load inline to convert Month in Month names, but the month names are shown in random order. How can it be achieved using MonthNames(variable used in qlikview by default in SET statement)or Month(date) function in edit script.

Thanks

7 Replies
Clever_Anjos
Employee
Employee

Would you mind posting your script?

alexandros17
Partner - Champion III
Partner - Champion III

In the object you are using there is a Tab "Sort", uncheck everithing and check Load Order

Let me know

Not applicable
Author

LOAD Year,

      [Order Type],

     Distributor,

     [SKU ID],

     [Actual Volume],

     [Actual Value]

FROM

[DS2 - Sales.xlsx]

(ooxml, embedded labels, table is Sheet1);

LOAD

* INLINE

    [ Month, Month_Name

    1, Jan

    2, Feb

    3, Mar

    4, Apr

    5, May

    6, Jun

    7, Jul

    8, Aug

    9, Sep

    10, Oct

    11, Nov

    12, Dec ];

How can i sort the month names in arranged order using ONLY edit script and not sort it in the expression,

Clever_Anjos
Employee
Employee

try this:

LOAD

Month, dual(Month,Month_Name) INLINE

    [ Month, Month_Name

    1, Jan

    2, Feb

    3, Mar

    4, Apr

    5, May

    6, Jun

    7, Jul

    8, Aug

    9, Sep

    10, Oct

    11, Nov

    12, Dec ];

MarcoWedel

When using the proper date formatting and interpretation functions, there will be no need for special translation tables.

For example, if you like to convert an integer representing a month to a month name, you could try with:

LOAD Month(Date#(MonthAsNumberField,'M')) as MonthName,

          someotherfields

FROM YourSource;

QlikCommunity_Thread_149107_Pic1.JPG

this way you get a dual value, meaning a textual representation of an underlying numerical value, i.e. sorting does not require any additional efforts.

see also:

Get the Dates Right

QlikView Date fields

hope this helps

regards

Marco

Anonymous
Not applicable
Author

Dual is a best way, I think.  Just a small correction - first parameter is string, the second is a number:

dual(Month_Name,Month) as Month

Clever_Anjos
Employee
Employee

Thanks Michael for fixing my code