# Why Quick default add table calculation (Percent difference) doesn't have any option to handle the NULL divide by zero errors?Its seriously lagging behind in terms of basic features compare to other BI tool available in market

**URL:** <https://community.amazonquick.com/t/why-quick-sight-default-add-table-calculation-percent-difference-doesnt-have-any-option-to-handle-the-null-divide-by-zero-errors-its-seriously-lagging-behind-in-terms-of-basic-features-compare-to-other-bi-tool-available-in-market/47096>\
**Category:** Q&A\
**Tags:** calculations, feature-request, Business-Intelligence-Engineer, quick-sight\
**Created:** [June 9, 2025, 7:56am UTC](https://community.amazonquick.com/t/why-quick-sight-default-add-table-calculation-percent-difference-doesnt-have-any-option-to-handle-the-null-divide-by-zero-errors-its-seriously-lagging-behind-in-terms-of-basic-features-compare-to-other-bi-tool-available-in-market/47096 "2025-06-09T07:56:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kousic](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@Kousic](https://community.amazonquick.com/u/Kousic)\
**Post date:** [June 9, 2025, 7:56am UTC](https://community.amazonquick.com/t/why-quick-sight-default-add-table-calculation-percent-difference-doesnt-have-any-option-to-handle-the-null-divide-by-zero-errors-its-seriously-lagging-behind-in-terms-of-basic-features-compare-to-other-bi-tool-available-in-market/47096/1 "2025-06-09T07:56:52Z")

</div>

Why Quick Sight default add table calculation (Percent difference) doesn’t have any option to handle the NULL divide by zero errors?Its seriously lagging behind in terms of basic features compare to other BI tool available in market.  
I have 20+ meassure values in a pivot table and I need to use WoW MoM and YoY calculation and show in a single column along with the weekly trend table typical Amazon WBR format. Surprisingly Quick Sight default add table calculation (Percent difference) doesn’t have any option to handle the NULL divide by zero errors which leave me only one option creating 60 calculated field using Lag formula and handle divide by zero/NULL error.  
Any help appreciated.

---

<div class="post-metadata">

**Author:** ![WLS-D](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/wls-d/32/36109_2.png) [@WLS-D](https://community.amazonquick.com/u/WLS-D)\
**Post date:** [June 9, 2025, 5:43pm UTC](https://community.amazonquick.com/t/why-quick-sight-default-add-table-calculation-percent-difference-doesnt-have-any-option-to-handle-the-null-divide-by-zero-errors-its-seriously-lagging-behind-in-terms-of-basic-features-compare-to-other-bi-tool-available-in-market/47096/2 "2025-06-09T17:43:06Z")

</div>

Hello @Kousic , welcome the Quick Sight community!

To my knowledge there is no way to tell Quick Sight how to handle null values in table calculations. That being said, other users have found work arouns using `ifelse` and `coalesce`.

Here’s an example:

> [@Excluding null values from calculations but not replacing them as 0](https://community.amazonquick.com/t/excluding-null-values-from-calculations-but-not-replacing-them-as-0/14313):
>
> I’m trying to make the below calculation to apply to various categories in the data. These calculated fields are aggregations from the data which contain scores from 0-10 as well as empty cells where a score wasn’t assigned. ({115 weighted}+{115b weighted }+{115d weighted}+{115e weighted}+{111 weighted})/100 when trying to execute this calculation some of the categories do not populate, I believe this may be because some categories have fields such as {111 weighted} that have no scores just n…

Let me know if this is what you were looking for. I will also mark this as a feature request for the Quick Sight team.

---

<div class="post-metadata">

**Author:** ![Kousic](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@Kousic](https://community.amazonquick.com/u/Kousic)\
**Post date:** [June 9, 2025, 6:58pm UTC](https://community.amazonquick.com/t/why-quick-sight-default-add-table-calculation-percent-difference-doesnt-have-any-option-to-handle-the-null-divide-by-zero-errors-its-seriously-lagging-behind-in-terms-of-basic-features-compare-to-other-bi-tool-available-in-market/47096/3 "2025-06-09T18:58:22Z")

</div>

I am using periodOverPeriodPercentDifference(distinct\_count({cf\_active\_deals}), {ad\_date}, WEEK, 1)  
can you help me how to handle NULL/divide by zero error here if my previous period data is NULL or zero?

I was trying with LAG but it was not working either:  
(  
{video\_preferred\_deal} - lag({video\_preferred\_deal}, [run\_date ASC], 1)  
) /  
ifelse(  
lag({video\_preferred\_deal}, [run\_date ASC], 1) = 0 OR isNull(lag({video\_preferred\_deal}, [run\_date ASC], 1)),  
1,  
lag({video\_preferred\_deal}, [run\_date ASC], 1)  
) \* 100

---

<div class="post-metadata">

**Author:** ![WLS-D](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/wls-d/32/36109_2.png) [@WLS-D](https://community.amazonquick.com/u/WLS-D)\
**Post date:** [June 11, 2025, 3:12pm UTC](https://community.amazonquick.com/t/why-quick-sight-default-add-table-calculation-percent-difference-doesnt-have-any-option-to-handle-the-null-divide-by-zero-errors-its-seriously-lagging-behind-in-terms-of-basic-features-compare-to-other-bi-tool-available-in-market/47096/4 "2025-06-11T15:12:33Z")

</div>

Hello @Kousic

When you say it wasn’t working do you mean it returned an error when you tried to save or the values it returned were wrong?

For your `periodOverPeriodPercentDifference` calculation you could try something like the following:  
**Check and replace null** = `ifelse(isNull({cf_active_deals}), 0, {cf_active_deals})`  
**WoW** = `periodOverPeriodPercentDifference({Check and replace null}, {ad_date}, WEEK,1)`

Basically what I’m trying to do is recreate the `cf_active_deals` (or other metric column) so that NULL is 0. Then do my calculating on that. If you add these to a table you’ll need to add the recreated field and then hide it to avoid a calc reference error.

You can also add a sample dataset to arena, that would be easier to troubleshoot:

> [@QuickSight Arena -- An embedded instance of QuickSight within the QuickSight Community](https://community.amazonquick.com/t/quicksight-arena-an-embedded-instance-of-quicksight-within-the-quicksight-community/21437):
>
> Watch this video for a 30 second intro to Arena. QuickSight Arena provides you with an embedded instance of QuickSight right within the QuickSight Community. Using Arena, you can: Explore creating QuickSight data visualization dashboards for free Publish dashboards to the Community [Gallery](https://community.amazonquick.com/c/gallery/44) to showcase your skills Include dashboards depicting your use case while posting questions in the [Community Q&A](https://community.amazonquick.com/c/question-and-answer/5) Clone underlying analysis views of published dashboards in order …
