# Mismatched aggregation error

**URL:** <https://community.amazonquick.com/t/mismatched-aggregation-error/14111>\
**Category:** Q&A\
**Tags:** quick-sight\
**Created:** [June 1, 2023, 2:21am UTC](https://community.amazonquick.com/t/mismatched-aggregation-error/14111 "2023-06-01T02:21:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tamnguyen](https://avatars.discourse-cdn.com/v4/letter/t/db5fbb/32.png) [@tamnguyen](https://community.amazonquick.com/u/tamnguyen)\
**Post date:** [June 1, 2023, 2:21am UTC](https://community.amazonquick.com/t/mismatched-aggregation-error/14111/1 "2023-06-01T02:21:58Z")

</div>

Could anyone tell me what’s wrong with the following code? Total order revenue is an aggregated (SUM) field, the other fields are non-aggregated!

ifelse({order star rating} \<= 3 AND {Total Order Revenue} \> 5000 AND {Sales Period Date} \>= parseDate(‘2022-04-01’), ‘3+’, toString({order star rating}))

It threw a `Mismatched Aggregation` error

---

<div class="post-metadata">

**Author:** ![andres007](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/andres007/32/8734_2.png) [@andres007](https://community.amazonquick.com/u/andres007)\
**Post date:** [June 1, 2023, 7:05am UTC](https://community.amazonquick.com/t/mismatched-aggregation-error/14111/2 "2023-06-01T07:05:45Z")

</div>

Hello,

From our documentation

> Custom aggregations can’t contain both aggregated and nonaggregated fields, in any combination. For example, this formula doesn’t work: `Sum(sales)+quantity`.

You can find more information on the documentation about [Aggregate functions](https://docs.aws.amazon.com/quicksight/latest/user/calculated-field-aggregations.html)
