# Custom Mode breaks variance percentage?

**URL:** <https://pug.phocassoftware.com/t/custom-mode-breaks-variance-percentage/2404>\
**Category:** Ask the Community\
**Created:** [February 23, 2023, 8:30pm UTC](https://pug.phocassoftware.com/t/custom-mode-breaks-variance-percentage/2404 "2023-02-23T20:30:09Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![JonKemp](https://sea1.discourse-cdn.com/flex015/user_avatar/pug.phocassoftware.com/jonkemp/32/334_2.png) [@JonKemp](https://pug.phocassoftware.com/u/JonKemp)\
**Post date:** [February 24, 2023, 9:55am UTC](https://pug.phocassoftware.com/t/custom-mode-breaks-variance-percentage/2404/2 "2023-02-24T09:55:32Z")

</div>

Hi @MatthewWalsh ,  
One thing I would suggest, is look at the error logs under your name after you execute the query, this should shed light as to what the issue is. My gut feel is this will be a DIV/0 error. You can get around this by adjusting your code to have the following logic:

^{a}/nullif({b},0)

Using this code will inspect the divsor ({b}), if the number is 0 (which would cause div/0) we mark it as NULL and therefore it returns 0. If you want to do something else other than 0 then you can use a case statement. Have a look at this post where I document how you use SQL commands within Custom Mode.

[https://pug.phocassoftware.com/t/percentage-share-in-custom-mode/](https://pug.phocassoftware.com/t/percentage-share-in-custom-mode/)

Regards,

Jon

---

_[View the full topic](https://pug.phocassoftware.com/t/custom-mode-breaks-variance-percentage/2404)._
