Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
kdaniels-obrien
Partner - Creator
Partner - Creator

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_R
Partner - Specialist
Partner - Specialist

Hi

try putting as a dimension  

or

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

Thanks 

Thanks and Regards
Kashyap.R

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_R
Partner - Specialist
Partner - Specialist

Hi

Try this

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

Hope this helps

Thanks

 

Thanks and Regards
Kashyap.R
kdaniels-obrien
Partner - Creator
Partner - Creator
Author

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

Kashyap_R
Partner - Specialist
Partner - Specialist

Hi

try putting as a dimension  

or

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

Thanks 

Thanks and Regards
Kashyap.R
kdaniels-obrien
Partner - Creator
Partner - Creator
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_R
Partner - Specialist
Partner - Specialist

Hi

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

Thanks

Thanks and Regards
Kashyap.R
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