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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
joeybird
Creator III
Creator III

calculation expression , display answer in as...


Hiya

I have a an time expression calculation

interval(avg(ShoppingTime)/1440,'h:mm') - interval(avg(ActualShoppingTime)/1440,'h:mm')

I wish to if the answer is a minus, just show 00:00:00 and not e.g - 01:00:00

is this possible please

1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

May be this:

Interval(If(Avg(ShoppingTime) - Avg(ActualShoppingTime) <= 0, 0, (Avg(ShoppingTime) - Avg(ActualShoppingTime))/1440), 'h:mm')

View solution in original post

4 Replies
Qrishna
Master
Master

Try

=fabs(interval(avg(ShoppingTime)/1440,'h:mm') - interval(avg(ActualShoppingTime)/1440,'h:mm'))

- fabs() function returns the absolute value of x. The result is a positive number.

marcus_sommer
MVP
MVP

I think you will need an if-check like:

interval(if(avg(ShoppingTime) <  avg(ActualShoppingTime), 0,

(avg(ShoppingTime) - avg(ActualShoppingTime)) /1440),'h:mm')

- Marcus

sunny_talwar
MVP
MVP

May be this:

Interval(If(Avg(ShoppingTime) - Avg(ActualShoppingTime) <= 0, 0, (Avg(ShoppingTime) - Avg(ActualShoppingTime))/1440), 'h:mm')

joeybird
Creator III
Creator III
Author

awesome thank you , worked brill