# Ad additional filter to chart with top & bottom filter

**URL:** <https://community.amazonquick.com/t/ad-additional-filter-to-chart-with-top-bottom-filter/43088>\
**Category:** Q&A\
**Tags:** filters, filters-controls-and-parameters, Business-Intelligence-Engineer, quick-sight\
**Created:** [February 26, 2025, 6:49pm UTC](https://community.amazonquick.com/t/ad-additional-filter-to-chart-with-top-bottom-filter/43088 "2025-02-26T18:49:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ArunM](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@ArunM](https://community.amazonquick.com/u/ArunM)\
**Post date:** [February 26, 2025, 6:49pm UTC](https://community.amazonquick.com/t/ad-additional-filter-to-chart-with-top-bottom-filter/43088/1 "2025-02-26T18:49:12Z")

</div>

I have standard sales data, : Product, User, Date, Revenue.  
I have a horizontal bar chart that shows bottom 5 user .  
I want to add a new filter to the horizontal bar chart that shows the bottom user over $ x revenue over last N weeks.  
Please help me add the filter to filter customers over $ x

---

<div class="post-metadata">

**Author:** ![lary\_andr](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/lary_andr/32/27681_2.png) [@lary\_andr](https://community.amazonquick.com/u/lary_andr)\
**Post date:** [February 26, 2025, 8:11pm UTC](https://community.amazonquick.com/t/ad-additional-filter-to-chart-with-top-bottom-filter/43088/2 "2025-02-26T20:11:00Z")

</div>

Hello @ArunM Hope this message finds you well!!

If I understand you well, my suggestion could be trying something like :First, set up a parameter named `RevenueThreshold` as a `Decimal` or `Integer`, depending on your needs, with a default value representing the minimum revenue for filtering. Next, create a parameter called `WeeksBack` as an `Integer` to specify how many weeks back you want to consider. Then, create a calculated field to filter dates within the last N weeks using a formula like `ifelse({Date} >= addDateTime(-1 * ${WeeksBack}, 'WK', now()), 1, 0)`. Additionally, create another calculated field to filter users based on the revenue threshold with `ifelse({Revenue} > ${RevenueThreshold}, 1, 0)`. Apply these filters to your bar chart by including only values where `IsInLastNWeeks` and `IsAboveRevenueThreshold` are equal to 1. Finally, ensure your bar chart is sorted in ascending order of revenue to display the users with the lowest revenue, and limit the number of bars shown to 5. This setup allows you to dynamically filter your chart to show users with the lowest revenue above a specified amount over the past N weeks, adjusting the parameters as needed for your analysis.

Please, tell me if it helps you

---

<div class="post-metadata">

**Author:** ![ArunM](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@ArunM](https://community.amazonquick.com/u/ArunM)\
**Post date:** [February 28, 2025, 1:09am UTC](https://community.amazonquick.com/t/ad-additional-filter-to-chart-with-top-bottom-filter/43088/3 "2025-02-28T01:09:20Z")

</div>

Thanks for your suggestion. It worked.

I improvised the ifelse({Revenue}  
to  
sumOver(sum({Revenue}),[{Product}],POST\_AGG\_FILTER)  
so that the Revenue is sumed across Product dimension.
