# Aggregations not working accurately

**URL:** <https://community.amazonquick.com/t/aggregations-not-working-accurately/28981>\
**Category:** Q&A\
**Tags:** Business-Intelligence-Engineer, quick-sight\
**Created:** [April 23, 2024, 10:39pm UTC](https://community.amazonquick.com/t/aggregations-not-working-accurately/28981 "2024-04-23T22:39:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmikay](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@gmikay](https://community.amazonquick.com/u/gmikay)\
**Post date:** [April 23, 2024, 10:39pm UTC](https://community.amazonquick.com/t/aggregations-not-working-accurately/28981/1 "2024-04-23T22:39:07Z")

</div>

I have an absolute delta calculated field on a weekly basis which has a value of 64,279 (table 1).  
I have the same table with another row added (node) in which again I get the total values (essentially the same thing as the first table but instead I get the total values as my table 1) which now sum up correctly. How can I make sure my pivot table aggregates the ABSOLUTE DELTA correctly in table 1?

 ![image](https://d1wl4jav5dp96l.cloudfront.net/original/3X/a/e/ae89e251703247fce1c552cbfc2792dd7ebdf392.png)

---

<div class="post-metadata">

**Author:** ![gmikay](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@gmikay](https://community.amazonquick.com/u/gmikay)\
**Post date:** [April 23, 2024, 10:45pm UTC](https://community.amazonquick.com/t/aggregations-not-working-accurately/28981/2 "2024-04-23T22:45:05Z")

</div>

![image](https://d1wl4jav5dp96l.cloudfront.net/original/3X/c/7/c770b4f5fa311ba5f14c1575cf7d740a375390a8.png)  
This is table 1

---

<div class="post-metadata">

**Author:** ![David\_Wong](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/david_wong/32/15630_2.png) [@David\_Wong](https://community.amazonquick.com/u/David_Wong)\
**Post date:** [April 24, 2024, 3:38am UTC](https://community.amazonquick.com/t/aggregations-not-working-accurately/28981/3 "2024-04-24T03:38:02Z")

</div>

Hi @gmikay,

Can you show the calculations for all your calculated fields?

---

<div class="post-metadata">

**Author:** ![gmikay](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@gmikay](https://community.amazonquick.com/u/gmikay)\
**Post date:** [April 24, 2024, 3:09pm UTC](https://community.amazonquick.com/t/aggregations-not-working-accurately/28981/4 "2024-04-24T15:09:56Z")

</div>

Of course, the data has a metric\_type column and a value column where the metric\_type column tells me what the value is referring to.  
actuals : ifelse({metric\_type} = ‘actual’, value, 0)  
wk1\_forecast: ifelse({metric\_type} = ‘wk1\_forecast’, value, 0)  
wk1\_delta: (sum(actuals-{wk1\_forecast}))  
wk1\_abs\_delta: abs(wk1\_delta)  
wk1\_WAPE: wk1\_abs\_delta/sum(actuals)

Would it be better for me use a data that is more horizontal, meaning instead of metric\_type, I should have a column for each value?

---

<div class="post-metadata">

**Author:** ![Xclipse](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/xclipse/32/20455_2.png) [@Xclipse](https://community.amazonquick.com/u/Xclipse)\
**Post date:** [April 29, 2024, 5:57pm UTC](https://community.amazonquick.com/t/aggregations-not-working-accurately/28981/5 "2024-04-29T17:57:38Z")

</div>

If you need further assistance, consider creating a sample dashboard with a sample dataset in Arena that illustrates your problem. Post it in a new thread for better visibility. You can find detailed instructions on how to use [Quick Sight Arena](https://community.amazonquick.com/t/quicksight-arena-an-embedded-instance-of-quicksight-within-the-quicksight-community/21437).
