Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Tell us which business and trade publications you read most regularly: RESPOND NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sorting by date DD/MM/YY

I've been searching this community for ways to sort bar charts by date. I've seen some examples in which people asked for sorting graphs by month (in which the suggestion is to use MonthStart), but I would like to sort by day.

In the data load editor I'm loading the date by using the following code:

Load

    Date("Trade Date",'YYYY-MM-DD') as "Trade Date",

    Identifier

FROM [lib://Desktop/sheet1.xlsx] (ooxml, embedded labels, table is 'sheet1');

Who knows how to do this?

1 Solution

Accepted Solutions
Not applicable
Author

Dear all,

I found the solution as follows:

Click Edit,

Select the bar chart,

Click "Sorting" on the right of the screen,

Drag Trade Date up

Thanks for thinking along.

Regards, Eveline

View solution in original post

8 Replies
mov
Employee
Employee

Dates are dual, if you cerate them correctly, that is they have both string and numeric values.  All you have to do is to sort date field by the numeric value.

If your dates are just the strings - use date#()function to format them as dates.  For example if they are strings in format YYYY-MM-DD, use:

date(date#("Trade Date", 'YYYY-MM-DD'))

maxgro
MVP
MVP

if your date field is right, sort by number in sort tab of your chart

if not

Get the Dates Right

Henric_Cronström

Not applicable
Author

Dear Michael,

My dates have only numeric values (in excel they consist of numbers only), however, sorting them numerically in Qlik Sense does not make a change. It's still sorted by values (large values first).

Ticking 'Sort by expression' and including the expression as you suggested, does not change the bar chart, it's still sorted by values instead of by dates.

Not applicable
Author

Dear Henric,

since I'm working with Qlik Sense, I'm curious where exactly to put the formulas you are suggesting in your article. Do I need to put it in the Data model viewer? Or should I use it to sort my bar chart by expression? I tried both, like Michael Solomovich suggested in his reply, but no success unfortunately.

Not applicable
Author

Dear all,

I found the solution as follows:

Click Edit,

Select the bar chart,

Click "Sorting" on the right of the screen,

Drag Trade Date up

Thanks for thinking along.

Regards, Eveline

mov
Employee
Employee

I suggested to sort by numeric, not by expression...  And, you have to uncheck sort by value.

Can you upload a QVW version of your app?

Henric_Cronström

It's really the same thing. What both Michael and I are suggesting, is to use the combination Date(Date#(...)) in the Load script, and sort the object numerically. You can use sort by expression, too, but this is overkill and not as efficient...

HIC