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: 
Not applicable

special sort of column

hi

as an example i would like to sort the following columns values

according to the period and year.

so for example the value p03 11 should come before p08 11 in the list and p12 12 should be last in the list.

it is possible to add a sorting function in Qlikview on the column for special sort?

Period

p08 11

p10 11

p03 11

p09 11

p12 12

p06 11

Best

Brad

16 Replies
Not applicable
Author

thanks however that groups all the periods 01 together so for example when sorting by text unfortunately

p01 12

p01 13

p01 14

best

Brad

Not applicable
Author

You could load the period as a dual number and text in the script and then just sort on numeric value with the display being text?

MarcoWedel

isn't that what you specified with the order sequence period first, year second?

Not applicable
Author

hello Marco!

i should be more clear with both the period and the year taken into consideration it should sort.

for example

p01 12

p02 12

p01 13

p02 13

p03 13

p01 14

p02 14

best

Brad

Not applicable
Author

hi rudolf.

thanks i have now attempted this as well but still it is bugging.

have a look at the screen shot below.

sorting.png

jaygarcia
Contributor III
Contributor III

I think this could be one way:

Add to your Load a field with the conversion of Period as Date format, and then you sort by that date field. Something like this:

LOAD *,

  date#('01'&'/'&(right(left(Period,3),2))&'/'&(right(Period,2))) as PeriodDate

INLINE [

Period

p08 11,

p10 11,

p03 11,

p09 11,

p03 13,

p12 12,

p06 11,

p03 12,

];

Best regards,

J

MarcoWedel

in this case, one solution could be to simply load it as date using the date#() function:

LOAD Date#(Period, 'pMM YY') as Period

Inline [

Period

p08 11

p10 11

p03 11

p09 11

p12 12

p06 11

p01 12

p02 12

p01 13

p02 13

p03 13

p01 14

p02 14

];

QlikCommunity_Thread_149407_Pic2.JPG

hope this helps

regards

Marco