Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

marksmunich
Contributor III

integer value as hours & minutes

Hello community,

I have  a calculated expression eg : sum(hours), which returns a integer value like 197   . how can i represent it like 197:00:00 or 197:00. I tried to change the format in properties-number as timestamp for this expression. but its not working. could some one help me in solving is this issue.

thanks

Mark

1 Solution

Accepted Solutions
MVP
MVP

Re: integer value as hours & minutes

Hi

Time is represented internally as a fraction of a day, so 0.25 is 6:00am (or 6 hours), 0.5 = 12:00 noon (or 12 hours).

Time() will format the fraction to a time of day. Interval will format the fraction as hours.

So in your case, you could use

     =Interval(sum(hours) / 24)

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
7 Replies
Not applicable

Re: integer value as hours & minutes

Hi Mark


Within the chart properties, go to the 'Number' tab and select time.  This allows you to reformat the time as you see fit (select the Time radio button and adjust the Format Pattern).

I hope this helps - let me know how you get on.

Steve

Luminary
Luminary

Re: integer value as hours & minutes

Or use the maketime(sum(hours)) function.

MVP
MVP

Re: integer value as hours & minutes

Hi

Time is represented internally as a fraction of a day, so 0.25 is 6:00am (or 6 hours), 0.5 = 12:00 noon (or 12 hours).

Time() will format the fraction to a time of day. Interval will format the fraction as hours.

So in your case, you could use

     =Interval(sum(hours) / 24)

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
MVP
MVP

Re: integer value as hours & minutes

=interval(interval#(sum(hours),'hh'),'hh:mm:ss')

marksmunich
Contributor III

Re: integer value as hours & minutes

its not working, i already used this

marksmunich
Contributor III

Re: integer value as hours & minutes

thanks jonathan, its working

Not applicable

Re: integer value as hours & minutes

It sounds like the hour simply being recognised as a number.  Use the formula below - although you may want to incorporate something into your script possibly to ensure you do not have to repeat the formula within your charts.

All the best.