Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
helen_pip
Creator III
Creator III

Round to 0 decimal places

Dear Qlikview User

Within the load I have a field called Total Time

The field is calculating the difference between 2 date fields

The Total Time field is calculated as follows:

(TimeA - TimeB) * 1440  AS Total Time

However I am returning values such as 4.890679000000000

Could someone kindly help me return a number with 0 decimal places

Kind Regards

Helen

1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

Did you try this:

Round((TimeA - TimeB) * 1440) As TotalTIme

View solution in original post

8 Replies
vishsaggi
Champion III
Champion III

Did you try this:

Round((TimeA - TimeB) * 1440) As TotalTIme

sunny_talwar

Is the number 4.890679 the correct number? You just want to round it? Do you want this to be Round up, round down or a regular round?

MarcoWedel

Maybe:


Interval(TimeA - TimeB, 'm') as TotalTime


or


Interval(TimeA - TimeB, 'mm:ss') as TotalTime


if you want to keep the seconds.




hope this helps


regards


Marco

Anonymous
Not applicable

squeakie_pig
Creator II
Creator II

you can use floor() or ceil() functions to force rounding up or down, or if you are ok with the automatic rounding, you can use formatting instead num(((TimeA - TimeB) * 1440), '##0')

ToniKautto
Employee
Employee

If TimeA and TimeB is accurately formatted, you will find the difference as Marco described above.

If the TimeA and TimeB are not accurately formatted as timestamps, you should look into how to accomplish this. Correctly formatted date, time and timestamp fields will allow you to utilize the date and Time functions.

4.890679 in Qlik means 4 days, 21 hours and 22 minutes. Is this the interval you expect from your calculation?

If not, please provide an example so that we can advise on how to change the formatting.

Anonymous
Not applicable

Hi helen_pip,

NUM(( TimeA - TimeB)* 1440,'##0')  AS Total Time

helen_pip
Creator III
Creator III
Author

Hello Vish

Thank you for your suggestion on this yesturday,  I have tried your suggestion and this works for me

Kind Regards

Helen