# Fuction help to give me 0 when is less than 0

**URL:** <https://forum.adalo.com/t/fuction-help-to-give-me-0-when-is-less-than-0/36830>\
**Category:** Get Help\
**Created:** [March 2, 2023, 2:26pm UTC](https://forum.adalo.com/t/fuction-help-to-give-me-0-when-is-less-than-0/36830 "2023-03-02T14:26:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![iquinto](https://avatars.discourse-cdn.com/v4/letter/i/c37758/32.png) [@iquinto](https://forum.adalo.com/u/iquinto)\
**Post date:** [March 2, 2023, 2:26pm UTC](https://forum.adalo.com/t/fuction-help-to-give-me-0-when-is-less-than-0/36830/1 "2023-03-02T14:26:36Z")

</div>

I’m trying to get how much time I have left to reach my goal in hours, I used a costum formula.  
I would like that when I reach my goal and exceed it instead of giving me a number less than 0 (example -1,-2,-3 etc) it gives me only 0.

is this possible with a function?

 ![1](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/3X/2/0/201d0203355ac83fb738e6cababdcd41c4f51f76.png)  
 ![2](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/3X/c/b/cbc5315c0fd48d15f919c19cd7cb0d9896886961.png)

---

<div class="post-metadata">

**Author:** ![charleshope](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/charleshope/32/25088_2.png) [@charleshope](https://forum.adalo.com/u/charleshope)\
**Post date:** [March 2, 2023, 3:46pm UTC](https://forum.adalo.com/t/fuction-help-to-give-me-0-when-is-less-than-0/36830/2 "2023-03-02T15:46:27Z")

</div>

Store the calculation in a property and use the value of it as a visibility condition.

You then duplicate the element. One element that only shows if the value is bigger than 0. The other elements only shows if it’s equal to 0 or less. On the later, you set the values to 0h.

---

<div class="post-metadata">

**Author:** ![iquinto](https://avatars.discourse-cdn.com/v4/letter/i/c37758/32.png) [@iquinto](https://forum.adalo.com/u/iquinto)\
**Post date:** [March 3, 2023, 8:51am UTC](https://forum.adalo.com/t/fuction-help-to-give-me-0-when-is-less-than-0/36830/3 "2023-03-03T08:51:38Z")

</div>

Thank you, i tried but in this case i need a buttom to update every time the property, I prefer to avoid this step if possible, while with a function everything becomes more automatic

---

<div class="post-metadata">

**Author:** ![iquinto](https://avatars.discourse-cdn.com/v4/letter/i/c37758/32.png) [@iquinto](https://forum.adalo.com/u/iquinto)\
**Post date:** [March 3, 2023, 1:29pm UTC](https://forum.adalo.com/t/fuction-help-to-give-me-0-when-is-less-than-0/36830/4 "2023-03-03T13:29:16Z")

</div>

i found the solution using this formula 0.5 \* (abs(x) + x)  
and it’s work

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/system/32/40401_2.png) [@system](https://forum.adalo.com/u/system)\
**Post date:** [March 13, 2023, 1:29pm UTC](https://forum.adalo.com/t/fuction-help-to-give-me-0-when-is-less-than-0/36830/5 "2023-03-13T13:29:41Z")

</div>

Closed on March 13, 2023, 1:29pm UTC

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
