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: 
prabhas277
Creator
Creator

adjust the column order

HI Experts,

I have one table in this i have number of columns  are there those are like 1/15,1/16,1/17 ,2/15,2/16,2/17,3/15,3/16,3/17 and soon.

In this 1/15,

1 is the first week of 2015 and in 2/16 2nd week of 2016 and etc..

Now i want the output like 1/15,2/15,3/15,1/16,2/16,3/16,1/17,2/17,3/17 like that..

How i can sort those columns?


Thanks in advance..



4 Replies
MK_QSL
MVP
MVP

Sort by expression from sort tab

=Num(SubField(WeekYear,'/',-1) & SubField(WeekYear,'/',1))

Where WeekYear is your FieldName.. Change the field name according to your need.

vinieme12
Champion III
Champion III

Try Sort by Expression with below expression

NUM(Right(Fieldname,2)&Num(Subfield(Fieldname,'/',1),'00'))

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Anonymous
Not applicable

Hi.

Try this. It works.

change your field format as below.

load date(date#(Weekyear,'M/YY'),'M/YY') as Weekyear

from table.qvd;

Now in the list box go to Properties --> Sort  --> check "Numeric Value --> Ascending"

test.JPG

It will Sort it automatically. Just Simple.

Anonymous
Not applicable

Hi,

If you want to do it at the script level,

table:


LOAD * INLINE [
    Weekyear
    1/15,
    1/16,
    1/17 ,
    2/15,
    2/16,
    2/17,
    3/15,
    3/16,
    3/17
]
;

NoConcatenate

table1:
load date(date#(Weekyear,'M/YY'),'M/YY') as Weekyear
resident table;


NoConcatenate

table2:
load Weekyear resident table1
order by Weekyear asc;

drop table table1;

drop table table;