Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Display current time in 12 hour format with AM/PM

Hi All,

I have a Date_D field and it has date and Time field. I want to create a bar chart to see how many call we do each hour in a day....how to create time expression.....

I am trying   ..... class(time(Date_D,2) as my time expression....but it is not showing AM and PM in format..

Thanks in Advance

Sid

1 Solution

Accepted Solutions
marcus_sommer

You mean you want a condition to show only certain time-buckets and they should be displayed in a very special format then it might be better to use if-loops for defining the buckets or even better a pick(match()) like:

pick(match(hour(frac(Date_D)), 8,9,10,11,12,13,14,15),

     '8 AM - 10 AM',

     '8 AM - 10 AM',

     '10 AM - 12 PM',

     '10 AM - 12 PM',

     ....)

and then hiding NULL on these dimension.

- Marcus

View solution in original post

4 Replies
marcus_sommer

Try something like this:

 

class(time(frac(Date_D), 'hh:mm:ss tt'), 1/24 * 2)

respectively reverse:

time(class(frac(Date_D), 1/24 * 2), 'hh:mm:ss tt')

- Marcus

Not applicable
Author

Hi Marcus,

Thanks for you reply !!!

What I needed was like ....

   

Hourfrequency
8 AM-10 AM20
10 AM-12PM19
12 PM - 2 PM21

2 PM-4

PM

16
marcus_sommer

You mean you want a condition to show only certain time-buckets and they should be displayed in a very special format then it might be better to use if-loops for defining the buckets or even better a pick(match()) like:

pick(match(hour(frac(Date_D)), 8,9,10,11,12,13,14,15),

     '8 AM - 10 AM',

     '8 AM - 10 AM',

     '10 AM - 12 PM',

     '10 AM - 12 PM',

     ....)

and then hiding NULL on these dimension.

- Marcus

Not applicable
Author

Thanks Marcus !!! you are a saviour !!!