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

How to sort the numeric value Of List box.

Hi Community,

I have date field in below format and i have to sort this value in List box in ascending order.

e.g.

Date

2016-12,

2016-1,

2016-10,

2016-5

Expected Output

2016-1,

2016-5,

2016-10,

2016-12

Please also refer below image

Date.png

Thanks in advance.

1 Solution

Accepted Solutions
sunny_talwar

Try this:

Dual(Year(Date) &'-'& Week (Date), WeekStart(Date)) As WEEK

View solution in original post

11 Replies
sunny_talwar

Is this field read as date by QlikView? May be try like this in the script

LOAD Date(Date#(Date, 'YYYY-MM'), 'YYYY-MM') as Date,

     ....

FROM ....;

Also, read here:

Why don’t my dates work?

Get the Dates Right

Anonymous
Not applicable
Author

Hi Sunny,

This date field according to user want to see Year and Week number.

Already i have created date logic in edit script  that is Year and Week number(2016-1).

and I also showed this value in Dashboard in List box.


but i want to proper sort order so how i sort this? that means


2016-15

2016-16

2016-17

2016-18

2016-19


like this.


sunny_talwar

How do you create this Year and Week field in the script?

tamilarasu
Champion
Champion

Hi Ishwar,

Try this as sort expression,

=Makeweekdate(Left(Field_Name,4),SubField(Field_Name,'-',2))

But best practice is to format the date field in script itself.

Anonymous
Not applicable
Author

Hi Sunny,


I have written below code for week in edit script

Year(Date) &'-'& Week (Date) As WEEK


Date is my date field.

this WEEK field showing me below result and i want to show this WEEK in ascending sort order in List box


Pleas refer below screen shot

Date.png

sunny_talwar

Try this:

Dual(Year(Date) &'-'& Week (Date), WeekStart(Date)) As WEEK

Anonymous
Not applicable
Author

Hi Tamil,

I have written logic for WEEK field in edit script and i want to show that field in List box in Ascending order.

Anonymous
Not applicable
Author

Hi Sunny,

Thanks for your help your logic is working properly. I got solution.

Please can you explain me your logic.

Anonymous
Not applicable
Author

Hi Sunny,

Thanks for your help. your logic is working properly. i got solution.

Pleas can you explain me your logic.