Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Sorting date in bar chart not working

Hi everyone.

I spent the last two days trying to solve this problem and looking for solutions in the forum but none of them worked. So here's the issue.

I have dates in the table I'm loading in the following format: YYYYMMDD.

The script I'm using is the following:

date((date#(DASCAX,'YYYYMMDD')),'DD/MM/YYYY') as [Expiration date],


I'm using this to let Qlik interpret my date and convert it in DD/MM/YYYY format.

I then have to create a bar chart which has date in MM-YYYY (or alternatively MMM-YYYY) on the x-axis.

When I create the dimension I specify the following:

=Date([Expiration Date],'MM-YYYY')

The problem comes when I try to order dates: whichever expression I use, dates are displayed as follows:

Cattura.PNG

How can I sort them? What am I getting wrong?

Thanks in advance

g

Tags (4)
1 Solution

Accepted Solutions

Re: Sorting date in bar chart not working

Have you tried to sort by your date dimension? And it should be sorted numerically

Capture.PNG

5 Replies
OmarBenSalem
Esteemed Contributor

Re: Sorting date in bar chart not working

Try this, in your script, create a new field :

,AutoNumber([Expiration Date], '%Date ID') as [%Date ID]

then in your chart, sort by this [%Date ID]

Not applicable

Re: Sorting date in bar chart not working

I lose any format (MM-YYYY) using autonumber in the script

OmarBenSalem
Esteemed Contributor

Re: Sorting date in bar chart not working

Keep your date field and add another field using autonumber.

In your chart, as a dimension use your date field and sort it by your DateID

Re: Sorting date in bar chart not working

Have you tried to sort by your date dimension? And it should be sorted numerically

Capture.PNG

Not applicable

Re: Sorting date in bar chart not working

I wasn't paying attention at the sorting order. I thought disabling any kind of sorting for my measure (placed first than dimension) would do the work as well.

Thanks  Sunny as always.

Community Browser