Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
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

Highlighted
MVP
MVP

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
Highlighted
Partner
Partner

Hi

Try this

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

Hope this helps

Thanks

 

Highlighted
Partner
Partner

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

Highlighted
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

Highlighted
Partner
Partner

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 

Highlighted
Partner
Partner

Hi

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

Thanks

Highlighted
MVP
MVP

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