# How to get a dynamic count when applying 2 filters to the same list?

**URL:** <https://community.glideapps.com/t/how-to-get-a-dynamic-count-when-applying-2-filters-to-the-same-list/22711>\
**Category:** Ask for Help\
**Created:** [February 13, 2021, 6:01am UTC](https://community.glideapps.com/t/how-to-get-a-dynamic-count-when-applying-2-filters-to-the-same-list/22711 "2021-02-13T06:01:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ray\_d](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@ray\_d](https://community.glideapps.com/u/ray_d)\
**Post date:** [February 13, 2021, 6:01am UTC](https://community.glideapps.com/t/how-to-get-a-dynamic-count-when-applying-2-filters-to-the-same-list/22711/1 "2021-02-13T06:01:55Z")

</div>

I have a list of videos that I would like to filter by two properties: Video Type + Video Style.  
I’m able to filter the list by using the filter properties on the component, and I’m also able to calculate the amount of videos that match the types individually, but I’m stuck on how to get a dynamic total for the remaining filtered items that match the filter criteria when both filters are applied.

> **[Dance Vocab](https://dvapp.glideapp.io/)**
>
> Learn dance moves and join the dance community

Is there a dynamic way to do this?

My Type Filters

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/5/35e1d6c53067db8b2923ef5bb80f5f18469b4415.png)

My Style Filters

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/e/fe43a16513c49ab792e847b5edca7c5672fd7e83.png)

With 2 filters applied, the result should be 1, and I want the filters to dynamically update to show the correct amount of results available in the dropdowns.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/1/018082619cf2e6a18c7892683e6b3931cea6c85a.png)

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [February 13, 2021, 6:13am UTC](https://community.glideapps.com/t/how-to-get-a-dynamic-count-when-applying-2-filters-to-the-same-list/22711/2 "2021-02-13T06:13:31Z")

</div>

I’ve recently done this with multiple filters (4, in my case).  
Here is the technique that I used (applied to your example):

- Create user specific columns for each choice component (Type, Style)
- Create a template column that concatenates these two columns
- Create another template column that concatenates those same two attributes (Type, Style) in your data
- Create a multi-relation between those two columns
- Make that multi-relation the source of your inline list
- To get the dynamic count, add a rollup using the same multi-relation column

Here is a short video that shows how that works (notice how the total - shown in the hint component - updates dynamically with each selection change).

---

<div class="post-metadata">

**Author:** ![ray\_d](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@ray\_d](https://community.glideapps.com/u/ray_d)\
**Post date:** [February 13, 2021, 6:53am UTC](https://community.glideapps.com/t/how-to-get-a-dynamic-count-when-applying-2-filters-to-the-same-list/22711/3 "2021-02-13T06:53:41Z")

</div>

awesome! will try this out!

---

<div class="post-metadata">

**Author:** ![Kemal](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@Kemal](https://community.glideapps.com/u/Kemal)\
**Post date:** [January 22, 2022, 1:33pm UTC](https://community.glideapps.com/t/how-to-get-a-dynamic-count-when-applying-2-filters-to-the-same-list/22711/4 "2022-01-22T13:33:16Z")

</div>

@Darren_Murphy  
Hi Darren! May I ask.

If I have 6 choice components and select for example only 2 out of 6 it wont show the amount of items selected by 2 choices. It needs all 6 choices to be selected.  
How to handle this issue?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [January 22, 2022, 1:52pm UTC](https://community.glideapps.com/t/how-to-get-a-dynamic-count-when-applying-2-filters-to-the-same-list/22711/5 "2022-01-22T13:52:38Z")

</div>

hmm, that post is quite old. Although the technique I described there could still be used, these days I’d probably recommend a slightly different approach that avoids complex relations.

With multiple choice components acting as filters, I’d be more likely to use the following approach:

- Write each choice component to a user specific column
- Use a series of single value columns to apply each choice selection to all rows in the table to be filtered
- Build logic in that table using one or more if-then-else columns to apply the filtering choices to each row. The end goal with this would be to have a single boolean column that indicates whether or not each row should be filtered. (`true` = filtered, `empty/false` = not filtered)
- Use the entire table in a single inline list component, filtering where the above column is not true
- And to get a dynamic count of filtered records, just do a rollup on the entire table, counting where that if-then-else column is not true.

The only really tricky part with the above is the if-then-else logic. The approach with this will vary from use case to use case, and can get quite hairy as the number of filters increases. But I’ve yet to encounter a situation where it can’t be done 😉

For an alternative approach that still uses dynamic relations, you can refer to [this method](https://community.glideapps.com/t/multi-filters-using-relations-a-new-way/36092) by @gvalero

---

<div class="post-metadata">

**Author:** ![Kemal](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@Kemal](https://community.glideapps.com/u/Kemal)\
**Post date:** [January 22, 2022, 1:59pm UTC](https://community.glideapps.com/t/how-to-get-a-dynamic-count-when-applying-2-filters-to-the-same-list/22711/6 "2022-01-22T13:59:06Z")

</div>

Thank you Darren for your help again!

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [January 22, 2022, 2:32pm UTC](https://community.glideapps.com/t/how-to-get-a-dynamic-count-when-applying-2-filters-to-the-same-list/22711/7 "2022-01-22T14:32:39Z")

</div>

A take on the method @Darren_Murphy is describing can be seen here:

> [@tornado Use Multiple Choice Components to Filter an Inline List](https://community.glideapps.com/t/use-multiple-choice-components-to-filter-an-inline-list/16932):
>
> [[Glide: Filter an Inline List with Choice Components] ](https://www.youtube.com/watch?v=NOYFsVUWQXw) Updated July 2022 
> 
> > **Version 1**
> >
> > \<a href="https://www.youtube.com/watch?v=rtbFccDKuH0"\>https://www.youtube.com/watch?v=rtbFccDKuH0\</a\>

---

<div class="post-metadata">

**Author:** ![Kemal](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@Kemal](https://community.glideapps.com/u/Kemal)\
**Post date:** [January 22, 2022, 2:39pm UTC](https://community.glideapps.com/t/how-to-get-a-dynamic-count-when-applying-2-filters-to-the-same-list/22711/8 "2022-01-22T14:39:37Z")

</div>

Thank you Robert!
