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
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
kdaniels-obrien
Partner
Partner

Show hour before date

Hi, 

I am creating an hour by hour chart.  I need help formatting my time so that it will display as HH tt MM-DD-YYYY. For example, I want the x-axis to show 10 AM 01-07-2020.  I don't want to just display the hour because it will stack the next day's hour by hour data.  Right now I am using: date([time],'MM-DD') & ' ' & mid([time],12,2) as NewDateHour and letting NewDateHour be the dimension, but this displays as 01-07 10. Can someone help me with a load script line to format time as 10 AM 01-07?  Thanks in advance!! 😁

2 Solutions

Accepted Solutions
kashyap
Partner
Partner

Hi

try putting as a dimension  

or

you can create a field in the script and use it in the chart

Thanks 

View solution in original post

Kushal_Chawda

You can create two separate field (Hour & Date) just for sort purpose like below

hour (DateField) as Hour

Date (DateField,DD/MM/YYY) as Date

You can change the format as per your choice

Now in chart properties->Sort-> for x-axis field -> Sort it by Expression -> Put below expression

=Hour & Date

View solution in original post

6 Replies
kashyap
Partner
Partner

Hi

Try this

Timestamp( Column, 'hh TT MM-DD-YYYY')

Hope this helps

Thanks

 

kdaniels-obrien
Partner
Partner
Author

Should I do this in the presentation layer(where I put my dimension)? 

kashyap
Partner
Partner

Hi

try putting as a dimension  

or

you can create a field in the script and use it in the chart

Thanks 

View solution in original post

kdaniels-obrien
Partner
Partner
Author

That didn't work as a dimension but I did create it in the load script.  The issue I'm having is it is sorting the x-axis by hours and I need it to sort by hour and  date.  For example, the chart's x-axis goes like.. 10 AM 1/1 10AM 1/2 10 AM 1/3.  I want it to display as 10 AM 1/1 11 AM 1/1 12 AM 1/1, etc 

kashyap
Partner
Partner

Hi

Can u share me a sample QVF file I will try and get u back

Thanks

Kushal_Chawda

You can create two separate field (Hour & Date) just for sort purpose like below

hour (DateField) as Hour

Date (DateField,DD/MM/YYY) as Date

You can change the format as per your choice

Now in chart properties->Sort-> for x-axis field -> Sort it by Expression -> Put below expression

=Hour & Date

View solution in original post