Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikvw2019
Contributor
Contributor

Straight table sort on date/time column

I have a straight table and  need to sort it as per a column which is Date/time format. I have below expression in the 

Chart Properties -> Sort 

=Date(Scheduled_Start_date,'dd/mm/yyyy hh:mm:ss')

And also promoted the column to the top but i am not seeing the right results.Capture.JPG

Resulting output

 

Capture2.JPG

 

I am seeing 2 rows from 2019 on the top. 

I am looking to sort this in the descending order of time

i.e 2020

1 Solution

Accepted Solutions
Kushal_Chawda

It looks like your date field is not in proper timestamp format. Set the timestamp variable in script like below

SET TimestampFormat='MM/DD/YYYY h:mm:ss TT';

Note:  Set the format of above variable based on the format of the field coming from source. For eg. Scheduled_Start_date values from source is '01/23/2019 04:01:33 AM' then set the variable format as above.

Now in script you can format the Scheduled_Start_date using timestamp function

LOAD *,

         timestamp(Scheduled_Start_date,'DD/MM/YYYY hh:mm:ss TT') as Scheduled_Start_date

FROM Source;

Now, in chart you can simply sort this field Numerically ascending or descending

View solution in original post

1 Reply
Kushal_Chawda

It looks like your date field is not in proper timestamp format. Set the timestamp variable in script like below

SET TimestampFormat='MM/DD/YYYY h:mm:ss TT';

Note:  Set the format of above variable based on the format of the field coming from source. For eg. Scheduled_Start_date values from source is '01/23/2019 04:01:33 AM' then set the variable format as above.

Now in script you can format the Scheduled_Start_date using timestamp function

LOAD *,

         timestamp(Scheduled_Start_date,'DD/MM/YYYY hh:mm:ss TT') as Scheduled_Start_date

FROM Source;

Now, in chart you can simply sort this field Numerically ascending or descending