# periodToDateSumOverTime function for one category

**URL:** <https://community.amazonquick.com/t/periodtodatesumovertime-function-for-one-category/11310>\
**Category:** Q&A\
**Tags:** period-over-period, calculations, quick-sight\
**Created:** [March 21, 2023, 4:03pm UTC](https://community.amazonquick.com/t/periodtodatesumovertime-function-for-one-category/11310 "2023-03-21T16:03:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PninaBarak](https://avatars.discourse-cdn.com/v4/letter/p/c4cdca/32.png) [@PninaBarak](https://community.amazonquick.com/u/PninaBarak)\
**Post date:** [March 21, 2023, 4:03pm UTC](https://community.amazonquick.com/t/periodtodatesumovertime-function-for-one-category/11310/1 "2023-03-21T16:03:20Z")

</div>

Hi,  
I have a measure that contains information about the amount of purchases. This variable contains information from different countries (I have a country field). I want to use the periodToDateSumOverTime function in order to sum the purchases from a certain country over a period of time. I want to use this field in a graph together with additional data that refer to all the countries, so I cannot filter the entire graph.  
I tried to use the ifelse function together with the periodToDateSumOverTime function but I got an error - mismatched aggregation.  
How can this be done?

---

<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:** [March 21, 2023, 6:03pm UTC](https://community.amazonquick.com/t/periodtodatesumovertime-function-for-one-category/11310/2 "2023-03-21T18:03:50Z")

</div>

This might sum it too many times, but you can add a nested sumOver the country.

periodToDateSumOverTime(sumOver(sum({metric}),[{country}]), {date}, MONTH)

---

<div class="post-metadata">

**Author:** ![qinya](https://avatars.discourse-cdn.com/v4/letter/q/b4bc9f/32.png) [@qinya](https://community.amazonquick.com/u/qinya)\
**Post date:** [March 24, 2023, 6:55pm UTC](https://community.amazonquick.com/t/periodtodatesumovertime-function-for-one-category/11310/3 "2023-03-24T18:55:21Z")

</div>

Hi @PninaBarak ,

Could you provide additional details of the error message and screenshot of your calculation and the visual?

Thanks,  
Qinya

---

<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:** [April 10, 2023, 6:41pm UTC](https://community.amazonquick.com/t/periodtodatesumovertime-function-for-one-category/11310/4 "2023-04-10T18:41:28Z")

</div>


