# Calculated field for Total% & Cumulative% with total column

**URL:** <https://community.amazonquick.com/t/calculated-field-for-total-cumulative-with-total-column/13587>\
**Category:** Q&A\
**Tags:** calculations, quick-sight\
**Created:** [May 18, 2023, 12:18am UTC](https://community.amazonquick.com/t/calculated-field-for-total-cumulative-with-total-column/13587 "2023-05-18T00:18:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sri](https://avatars.discourse-cdn.com/v4/letter/s/e9a140/32.png) [@Sri](https://community.amazonquick.com/u/Sri)\
**Post date:** [May 18, 2023, 12:18am UTC](https://community.amazonquick.com/t/calculated-field-for-total-cumulative-with-total-column/13587/1 "2023-05-18T00:18:33Z")

</div>

Hi,  
I want to create a calculated fields for the total% and cumulative% using the total column for all the products.  
Example,  
|Product|Total|Total%|Cumulative%|  
|A|23|29.87012987|29.87012987|  
|B|34|44.15584416|74.02597403|  
|C|16|20.77922078|94.80519481|  
|D|4|5.194805195|100|

Could someone help me with the formula to have the fields created as shown in the example with the percentage precision to 2 digits.

---

<div class="post-metadata">

**Author:** ![sakkamzn](https://avatars.discourse-cdn.com/v4/letter/s/0ea827/32.png) [@sakkamzn](https://community.amazonquick.com/u/sakkamzn)\
**Post date:** [May 18, 2023, 2:48pm UTC](https://community.amazonquick.com/t/calculated-field-for-total-cumulative-with-total-column/13587/2 "2023-05-18T14:48:04Z")

</div>

Here is the function you can use to calculate the percent of the total

> **[percentOfTotal - Amazon QuickSight](https://docs.aws.amazon.com/quicksight/latest/user/percentOfTotal-function.html)**
>
> The percentOfTotal function calculates the percentage a measure contributes to the total, based on the dimensions specified.

Also, take a look at the blog below for performing cumulative functions.

> **[Add comparative and cumulative date/time calculations in Amazon QuickSight |...](https://aws.amazon.com/blogs/big-data/add-comparative-and-cumulative-date-time-calculations-in-amazon-quicksight/)**
>
> Amazon QuickSight recently added native support for comparative (e.g., year-over-year) and cumulative (e.g., year-to-date) period functions which allow you to easily introduce these calculations in business reporting, trend analysis and time series...

Hope this helps. if you looking for something different. let us know.

---

<div class="post-metadata">

**Author:** ![Sri](https://avatars.discourse-cdn.com/v4/letter/s/e9a140/32.png) [@Sri](https://community.amazonquick.com/u/Sri)\
**Post date:** [May 18, 2023, 4:02pm UTC](https://community.amazonquick.com/t/calculated-field-for-total-cumulative-with-total-column/13587/3 "2023-05-18T16:02:24Z")

</div>

Hi [sakkamzn],  
Thank you for your response. But, I might have missed to explain that the total is not a direct numeric field. Total is a distinct count of a string. So i’m unable to use percentofTotal & comparative calculations.

---

<div class="post-metadata">

**Author:** ![Max](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/max/32/2288_2.png) [@Max](https://community.amazonquick.com/u/Max)\
**Post date:** [June 27, 2023, 12:09am UTC](https://community.amazonquick.com/t/calculated-field-for-total-cumulative-with-total-column/13587/4 "2023-06-27T00:09:41Z")

</div>

Hi @Sri

What is your dataset? Is it possible for you to handle this at the dataset level?

---

<div class="post-metadata">

**Author:** ![Max](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/max/32/2288_2.png) [@Max](https://community.amazonquick.com/u/Max)\
**Post date:** [June 30, 2023, 7:23pm UTC](https://community.amazonquick.com/t/calculated-field-for-total-cumulative-with-total-column/13587/5 "2023-06-30T19:23:41Z")

</div>


