Activation Time <10
I'm trying to get a percentage of less than 10 mints, in dataset I have values where start time is before the arrival time and instead of counting them as negative it displaying positive, how Can I fix this.
SUM((CASE
WHEN (TIME_TO_SEC(timeDIFF(`Start Time (UTC)`, `Arrival Time (UTC)`)) / 60) <=10 THEN 1
END))
/
SUM((CASE WHEN `Case Number` is not null then 1
end))
Best Answers

Ah the reason I'm not a fan of TIMEDIFF. In cases like this I prefer to use UNIX_TIMESTAMP and math to calculate the difference in seconds between two different timestamps.
SUM((CASE WHEN ((UNIX_TIMESTAMP(`Start Time (UTC)`)  UNIX_TIMESTAMP(`Arrival Time (UTC)`)) / 60) <=10 THEN 1 END)) / SUM((CASE WHEN `Case Number` is not null then 1 end))
One question of clarification  If a start time comes 15 minutes before the arrival time (15 minutes) should that be included since 15 < 10 or should it be excluded since the absolute duration is greater than 10? If it should be excluded you can wrap the subtraction in the ABS function to get the absolute value.
**Was this post helpful? Click the heart icon**
**Did this solve your problem? Accept it as a solution!**2 
You can use the ABS() function to turn any negative number into a positive number.
ABS
Returns the absolute value for all values in a numeric column.In other words, any negative values become positive, and positive values stay the same. This is valuable when you want to see aggregation without considering positive and negative values.
ABS('Operating Budget')
**Make sure to like any users posts that helped you and accept the ones who solved your issue.**1
Answers

You can utilize an additional clause inside your case statement to swap the values if necessary:
SUM((CASE WHEN `Start Time (UTC)` <= `Arrival Time (UTC)` AND (TIME_TO_SEC(timeDIFF(`Start Time (UTC)`, `Arrival Time (UTC)`)) / 60) <=10 THEN 1 WHEN `Start Time (UTC)` > `Arrival Time (UTC)` AND (TIME_TO_SEC(timeDIFF(`Arrival Time (UTC)`, `Start Time (UTC)`)) / 60) <=10 THEN 1 END)) / SUM((CASE WHEN `Case Number` is not null then 1 end))
**Was this post helpful? Click the heart icon**
**Did this solve your problem? Accept it as a solution!**0 
Thanks, but this is giving me no results also I need to include those rows.
0 
Try adding ELSE 0 in your case statement like this:
SUM((CASE WHEN (TIME_TO_SEC(timeDIFF(`Start Time (UTC)`, `Arrival Time (UTC)`)) / 60) <=10 THEN 1 ELSE 0 END)) / SUM((CASE WHEN `Case Number` is not null then 1 ELSE 0 end))
**Make sure to like any users posts that helped you and accept the ones who solved your issue.**0 
It will still not solve the problem as the Response time should be negative and not positive. like the first one 8 mints
0 
Interestingly, when I put this into my beast mode:
TIMEDIFF('4:46:11 PM','4:54:28 PM')
It resulted in a value of 23:51:43 rather than the negative approx. 8 minutes as you would expect. It seems as though Domo's implementation doesn't match MySQL's implementation, which is what it typically follows.
I think if you took this knowledge and added your time to sec function and then subtracted from 86400 (seconds in a day) and divide by 60, you will get to your minutes and be able to put this into your case statement.
I would suggest building this up gradually after adding each function and view the results in the table card to make sure you are seeing the results you would expect rather than trying to jump to the final result.
Hope this helps.
**Make sure to like any users posts that helped you and accept the ones who solved your issue.**0 
Thank you Grant, this has solved the problem but not sure why it's counting the time more than 10 mints :(
it's only few rows and doesn't effect the # that much but still...
0 
is there a way to make the negative numbers into positive?
As this solve the problem with time but then when you sum it's not the right number.
0 
thank you, Grant & Mark.
This really solve the problem :)
0
Categories
 10.6K All Categories
 APAC User Group
 12 Welcome
 36 Domo News
 9.6K Using Domo
 1.9K Dataflows
 2.4K Card Building
 2.2K Ideas Exchange
 1.2K Connectors
 338 Workbench
 250 Domo Best Practices
 11 Domo Certification
 460 Domo Developer
 47 Domo Everywhere
 100 Apps
 703 New to Domo
 84 Dojo
 Domopalooza
 1.1K 日本支部
 4 道場日本支部へようこそ
 22 お知らせ
 62 Kowaza
 295 仲間に相談
 649 ひらめき共有