Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to get only the working hours in the chart

Hi ,

My requirement is to display the working hours which is 8: 00 am --- 17:00 pm  in the bar chart.

I have used the expression =Hour(Timestamp(MyHour)) this is displaying all the hours in a day.

Can anyone help please.

thanks,

vamsi.

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You could create a field WorkingHours in the script based on your MyHour field and then use that new field as dimension in your chart

MyData:

LOAD

     *,

     If(Hour>=8 and Hour<=17, Hour) as WorkingHour

     ;

LOAD

     ...fields...,

     MyHour,

     Floor(Frac(MyHour)*24) as Hour,

     ...other fields...

FROM

     ...sourcedata...

     ;


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You could create a field WorkingHours in the script based on your MyHour field and then use that new field as dimension in your chart

MyData:

LOAD

     *,

     If(Hour>=8 and Hour<=17, Hour) as WorkingHour

     ;

LOAD

     ...fields...,

     MyHour,

     Floor(Frac(MyHour)*24) as Hour,

     ...other fields...

FROM

     ...sourcedata...

     ;


talk is cheap, supply exceeds demand
Anil_Babu_Samineni

You can use like below, Remind please calculate Hours in 24 Hours format..

If Dimension

If(Hours >= 8 and Hours <= 17, Hours)


If Expression

Sum({<Hours = {">=8 <=17"}>} Measure)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Hi,

I was using this

if(timestamp(floor(created_at)>=8 and floor(created_at) <=17,created_at )+ Maketime(hour(created_at)), 'hh:mm') as MyHour,

I was getting this.

What am i doing wrong here?

demo.png

Anonymous
Not applicable
Author

Hi,

i have got it now

I have used the this in the dimension

=IF(Hour(Interval(created_at,'hh')) >= 8 AND Hour(Interval(created_at,'hh')) <=17, Hour(Interval(created_at,'hh')))

Anonymous
Not applicable
Author

Thanks for helping me,