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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need to format average time from decimal to hours:seconds

Hi All,

I have a calucation below on a dashboard gauge  that computes the average time it takes to complete an order.  The calculation is done at the database level but returns the hours in franctions, for example 13.85 hours.  The users would like QlikView to return the result in the time format HH:SS which would be 13:51 Hrs:Seconds.  I've tried a number of attempts with interval, but I was not successful.  Any help would be appreciated. 

Thank you.

Don

=avg((ORDER_TO_COMPLETE_HRS)

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Have a look at the below example.

    Hope this will solve your problem

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

5 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   you can use date() function to achieve this.

   for example

   =date(40715.188020833,'h:mm:ss')

    Hope this will help you.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
matt_crowther
Specialist
Specialist

Don,

This is a complete Pre-Sales / Data Monkey solution but it should work:

Split out the decimal part of the value ('.85') - this in essence is 85% so use this to calculate 85% of 60 which will then give you the minutes; rebuild the value in the script to deliver your '13:51' value. Functions to use would be right(), and '&'.

No reason why this wouldn't work on a line by line basis.

There may well be a neater solution but if Qlikview doesn't recognise the value as a date / time then using num() etc isn't going to work.

Any problems just post some sample data and I'll try and take a look.

Hope that helps,

Matt - Visual Analytics Ltd

Not applicable
Author

Thank you Kaushik and Matt.  Kaushik, the date function won't work because the order_to_complete is a number not a date.  Matt I will give your solution a try.  I wasn't sure that I was missing something obvious.  I have to use the database function's return because it is based on company workdays and times so that part is not an easy calculation. 

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Have a look at the below example.

    Hope this will solve your problem

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Kaushik, thank you very much for your solution.  I will be able to add it to my load script and display the time correctly.