# Aggregation over specific group

**URL:** <https://community.amazonquick.com/t/aggregation-over-specific-group/31154>\
**Category:** Q&A\
**Tags:** error, developer, quick-sight\
**Created:** [June 11, 2024, 7:14am UTC](https://community.amazonquick.com/t/aggregation-over-specific-group/31154 "2024-06-11T07:14:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jakub](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@Jakub](https://community.amazonquick.com/u/Jakub)\
**Post date:** [June 11, 2024, 7:14am UTC](https://community.amazonquick.com/t/aggregation-over-specific-group/31154/1 "2024-06-11T07:14:15Z")

</div>

Hello all,

I have an issue with aggregating data within multiple dimensions at once. Please let me know if this is possible at all. I have data set in specific format:

| model | option | option\_count | TotalModels | Ratio | Performance | Negative | Negative\_sum | Positive | Positive\_sum |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| G | 2VW | 4959 | 50000 | 0,09918 | negative | 1 | 4 | 0 | 5 |
| G | 2VV | 22198 | 50000 | 0,44396 | negative | 1 | 4 | 0 | 5 |
| G | 3AC | 12633 | 50000 | 0,25266 | negative | 1 | 4 | 0 | 5 |
| G | 3DK | 19667 | 50000 | 0,39334 | negative | 1 | 4 | 0 | 5 |
| G | 4NR | 43951 | 50000 | 0,87902 | positive | 0 | 4 | 1 | 5 |
| G | 3AR | 24890 | 50000 | 0,4978 | positive | 0 | 4 | 1 | 5 |
| G | 3M1 | 44625 | 50000 | 0,8925 | positive | 0 | 4 | 1 | 5 |
| G | 5AU | 43792 | 50000 | 0,87584 | positive | 0 | 4 | 1 | 5 |
| G | 2TE | 46311 | 50000 | 0,92622 | positive | 0 | 4 | 1 | 5 |
| U | 2VW | 43534 | 100000 | 0,43534 | negative | 1 | 7 | 0 | 3 |
| U | 2VV | 45802 | 100000 | 0,45802 | negative | 1 | 7 | 0 | 3 |
| U | 3AC | 3737 | 100000 | 0,03737 | negative | 1 | 7 | 0 | 3 |
| U | 3DK | 56766 | 100000 | 0,56766 | negative | 1 | 7 | 0 | 3 |
| U | 4NR | 45361 | 100000 | 0,45361 | negative | 1 | 7 | 0 | 3 |
| U | 3AR | 12162 | 100000 | 0,12162 | negative | 1 | 7 | 0 | 3 |
| U | 3M1 | 44569 | 100000 | 0,44569 | negative | 1 | 7 | 0 | 3 |
| U | 5AU | 94709 | 100000 | 0,94709 | positive | 0 | 7 | 1 | 3 |
| U | 2TE | 50863 | 100000 | 0,50863 | positive | 0 | 7 | 1 | 3 |
| U | 3NR | 60994 | 100000 | 0,60994 | positive | 0 | 7 | 1 | 3 |

For each model, multiple additional options can be selected. I calculate ratio per option and than divide it into ‘positive’ and ‘negative’ categories depending on ratio value. The difficulty here is that user might filter data per country and then all values will change, so all calculations should be dynamic.

The calculations I have for now are the following:  
Ratio = sum({option\_count})/max(TotalModels})  
Performance = ifelse(Ratio\>0.5, “positive”, “negative”)

I would like to calculate number of Positive/Negative per ‘model’ and it works fine when I have table with both ‘model’ and ‘option’ as you can see above. However, this value should be presented on bar chart with ‘model’ on x-axis. When there is no ‘option’, the calculation does not work, what can be seen in table below:

| model | TotalModel | Negative\_sum | Positive\_sum |
| --- | --- | --- | --- |
| G | 50000 | 0 | 0 |
| U | 100000 | 0 | 0 |

The calculations I have for now are the following:  
Negative = ifelse(Performance=“negative”,1,0)  
Negative\_sum = sumOver(Negative,[{model}])

Is there a way to calculate number of ‘Negatives’ per model in a dynamic way and show it without additional information about ‘option’?

Number of ‘Negatives’ is dynamic. When user filter for US there might be 5 values, but for Australia 7 values.

Thank you in advance for your support!

---

<div class="post-metadata">

**Author:** ![Koushik\_Muthanna](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/koushik_muthanna/32/3290_2.png) [@Koushik\_Muthanna](https://community.amazonquick.com/u/Koushik_Muthanna)\
**Post date:** [June 11, 2024, 8:51am UTC](https://community.amazonquick.com/t/aggregation-over-specific-group/31154/2 "2024-06-11T08:51:11Z")

</div>

@Jakub ,

I think you would have to use level aware calculations, have a look at our blog : [Create advanced insights using level-aware calculations in Amazon QuickSight | AWS Business Intelligence Blog](https://aws.amazon.com/blogs/business-intelligence/create-advanced-insights-using-level-aware-calculations-in-amazon-quicksight/)

Furthermore you can use arena to load the sample data and create an analysis , other community can help by providing correct calculations : [QuickSight Arena -- An embedded instance of QuickSight within the QuickSight Community](https://community.amazonquick.com/t/quicksight-arena-an-embedded-instance-of-quicksight-within-the-quicksight-community/21437)

Kind regards,  
Koushik

---

<div class="post-metadata">

**Author:** ![Jakub](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@Jakub](https://community.amazonquick.com/u/Jakub)\
**Post date:** [June 11, 2024, 9:45am UTC](https://community.amazonquick.com/t/aggregation-over-specific-group/31154/3 "2024-06-11T09:45:45Z")

</div>

Thank you @Koushik_Muthanna!

I uploaded example into Arena: [Aggregation over specific group](https://community.amazonquick.com#Arena-dashboardId=4e8547cc-92b5-4cf0-8926-a9237491401c&authorId=CU-15068)

On the dashboard, I would like the values in the bottom table should be the same as for the top table, so 4 for model G and Negative\_sum and 5 for model G and Positive\_sum:

 ![image](https://d1wl4jav5dp96l.cloudfront.net/original/3X/4/c/4cdcb8785c4588c52d51d09b6cc6cb89008097a3.png)

---

<div class="post-metadata">

**Author:** ![Koushik\_Muthanna](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/koushik_muthanna/32/3290_2.png) [@Koushik\_Muthanna](https://community.amazonquick.com/u/Koushik_Muthanna)\
**Post date:** [June 25, 2024, 9:09am UTC](https://community.amazonquick.com/t/aggregation-over-specific-group/31154/4 "2024-06-25T09:09:24Z")

</div>

@Jakub ,

Using LAC-A you can group the data at a different dimension . Arena example : [Aggregation over specific group](https://community.amazonquick.com#Arena-dashboardId=c673f7d0-dd6a-4203-bb41-a4815e0a2c67&authorId=CU-140)

Kind regards,  
Koushik

---

<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:** [June 28, 2024, 4:06am UTC](https://community.amazonquick.com/t/aggregation-over-specific-group/31154/5 "2024-06-28T04:06:37Z")

</div>

Did this solution work for you? I am marking this reply as, “Solution,” but let us know if this is not resolved. Thanks for posting your questions on the Quick Sight Community!
