# RunningSum/Cumulative Total

**URL:** <https://community.amazonquick.com/t/runningsum-cumulative-total/24363>\
**Category:** Q&A\
**Tags:** calculations, Business-Intelligence-Engineer, quick-sight\
**Created:** [January 29, 2024, 4:44pm UTC](https://community.amazonquick.com/t/runningsum-cumulative-total/24363 "2024-01-29T16:44:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![akshaym](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@akshaym](https://community.amazonquick.com/u/akshaym)\
**Post date:** [January 29, 2024, 4:44pm UTC](https://community.amazonquick.com/t/runningsum-cumulative-total/24363/1 "2024-01-29T16:44:45Z")

</div>

Hi All,

I am trying to create a calculated field that will show me the running sum/ cumulative total for each year. But, I don’t want a cumulative total from the start of that year. So, for example if in 2017 I made 5 sales, my cumulative total should be 0 for year 2017. And it should be added in 2018. The reason to do this is to show how many sales are being done in that year and how much contribution it has towards the cumulative total.

Any help would be highly appreciated

Thanks,  
Akshay

 ![image](https://d1wl4jav5dp96l.cloudfront.net/original/3X/3/2/32d20782d9fd92f5f3619dc65d7edaa4ae81e55b.png)

---

<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:** [January 29, 2024, 10:43pm UTC](https://community.amazonquick.com/t/runningsum-cumulative-total/24363/2 "2024-01-29T22:43:57Z")

</div>

Hello @akshaym !

I would recommend using the lag function:

> **[Lag - Amazon QuickSight](https://docs.aws.amazon.com/quicksight/latest/user/lag-function.html)**
>
> The lag function calculates the lag (previous) value for a measure based on specified partitions and sorts.

---

<div class="post-metadata">

**Author:** ![akshaym](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@akshaym](https://community.amazonquick.com/u/akshaym)\
**Post date:** [January 30, 2024, 2:07pm UTC](https://community.amazonquick.com/t/runningsum-cumulative-total/24363/3 "2024-01-30T14:07:12Z")

</div>

Hi @WLS-D,

Thank you for your help. This is exactly what I was looking for

Thanks,  
Akshay

---

<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:** [January 30, 2024, 3:25pm UTC](https://community.amazonquick.com/t/runningsum-cumulative-total/24363/4 "2024-01-30T15:25:32Z")

</div>

@akshaym no problem at all, it’s a really useful function!
