Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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

Re: Sorting by date DD/MM/YY

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

8 Replies
mov
Esteemed Contributor III

Re: Sorting by date DD/MM/YY

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'))

MVP
MVP

Re: Sorting by date DD/MM/YY

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

if not

Get the Dates Right

Employee
Employee

Re: Sorting by date DD/MM/YY

Not applicable

Re: Sorting by date DD/MM/YY

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

Re: Sorting by date DD/MM/YY

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

Re: Sorting by date DD/MM/YY

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
Esteemed Contributor III

Re: Sorting by date DD/MM/YY

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?

Employee
Employee

Re: Sorting by date DD/MM/YY

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