# Math function abs

**URL:** <https://discuss.dgraph.io/t/math-function-abs/9331>\
**Category:** Dgraph\
**Tags:** kind:feature\
**Created:** [August 10, 2020, 11:16am UTC](https://discuss.dgraph.io/t/math-function-abs/9331 "2020-08-10T11:16:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![myo](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/myo/32/872_2.png) [@myo](https://discuss.dgraph.io/u/myo)\
**Post date:** [August 10, 2020, 11:16am UTC](https://discuss.dgraph.io/t/math-function-abs/9331/1 "2020-08-10T11:16:16Z")

</div>

Hello,

I regularly need an `absloute value` function in dgraph queries.

Would it be possible to add `abs( <exp> )`?

Today, I tried with:

```auto
math(cond(var<0, -var, var))

```

But when `var` is empty, it crashes with: `Expected a value variable in cond but missing`

So I ended up doing:

```auto
math(max(var, 0)-min(var, 0))

```

which doesn’t care if var is empty.

---

<div class="post-metadata">

**Author:** ![Neeraj](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/neeraj/32/3104_2.png) [@Neeraj](https://discuss.dgraph.io/u/Neeraj)\
**Post date:** [August 12, 2020, 2:41am UTC](https://discuss.dgraph.io/t/math-function-abs/9331/2 "2020-08-12T02:41:51Z")

</div>

Hey @myo,

You can create a feature request for this on github. We’ll be able to work on it.

---

<div class="post-metadata">

**Author:** ![myo](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/myo/32/872_2.png) [@myo](https://discuss.dgraph.io/u/myo)\
**Post date:** [August 12, 2020, 5:29am UTC](https://discuss.dgraph.io/t/math-function-abs/9331/3 "2020-08-12T05:29:03Z")

</div>

Hi @Neeraj, I thought feature requests moved here. The github issue section is now closed.

---

<div class="post-metadata">

**Author:** ![Neeraj](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/neeraj/32/3104_2.png) [@Neeraj](https://discuss.dgraph.io/u/Neeraj)\
**Post date:** [August 12, 2020, 6:09am UTC](https://discuss.dgraph.io/t/math-function-abs/9331/4 "2020-08-12T06:09:56Z")

</div>

Oh, I totally forgot about that. Made this a feature request.  
Thanks

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [August 12, 2020, 6:16am UTC](https://discuss.dgraph.io/t/math-function-abs/9331/5 "2020-08-12T06:16:18Z")

</div>

@Neeraj and @myo not exactly. This place `/users/dgraph` is used to community conversations and questions. Issues must go to `/issues/dgraph/`.

---

<div class="post-metadata">

**Author:** ![myo](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/myo/32/872_2.png) [@myo](https://discuss.dgraph.io/u/myo)\
**Post date:** [August 12, 2020, 6:35am UTC](https://discuss.dgraph.io/t/math-function-abs/9331/6 "2020-08-12T06:35:46Z")

</div>

Thx @MichelDiz, I’m not used to the new organisation yet.  
I thought issues were set as tags, not from a given URL or path.  
If I click on the menu, then issues, I can find this thread, so I don’t understand what the issues section is.

---

<div class="post-metadata">

**Author:** ![Naman](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/naman/32/3498_2.png) [@Naman](https://discuss.dgraph.io/u/Naman)\
**Post date:** [August 12, 2020, 9:24am UTC](https://discuss.dgraph.io/t/math-function-abs/9331/7 "2020-08-12T09:24:02Z")

</div>

The `Issues` category that you see near the title is same as the `Issues` section that Michel talked about in the above conversation. `Issues>Dgraph` is the subcategory. 🙂  
Also, you can see all the `issues` for `dgraph` subcategory at [http://discuss.hypermode.com/c/issues/dgraph/](http://discuss.hypermode.com/c/issues/dgraph/).
