
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you try this:
Round((TimeA - TimeB) * 1440) As TotalTIme

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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')


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi helen_pip,
NUM(( TimeA - TimeB)* 1440,'##0') AS Total Time

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Vish
Thank you for your suggestion on this yesturday, I have tried your suggestion and this works for me
Kind Regards
Helen
