# Filter multiple choice list based on previous question

**URL:** <https://forum.dimagi.com/t/filter-multiple-choice-list-based-on-previous-question/8137>\
**Category:** Users\
**Created:** [April 14, 2021, 9:50pm UTC](https://forum.dimagi.com/t/filter-multiple-choice-list-based-on-previous-question/8137 "2021-04-14T21:50:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cml1227](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/c/f07891/32.png) [@cml1227](https://forum.dimagi.com/u/cml1227)\
**Post date:** [April 14, 2021, 9:50pm UTC](https://forum.dimagi.com/t/filter-multiple-choice-list-based-on-previous-question/8137/1 "2021-04-14T21:50:40Z")

</div>

Hello, I am trying to set up a filtered question using a look up table but am struggling to set it up properly.

I am trying to create a question (primary\_shock) where the set of options are those that were selected from another multiple choice question (new\_shock). Would someone be able to share the right syntax for setting this up.

Thanks!

---

<div class="post-metadata">

**Author:** ![Clayton\_Sims](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/clayton_sims/32/496_2.png) [@Clayton\_Sims](https://forum.dimagi.com/u/Clayton_Sims)\
**Post date:** [April 15, 2021, 4:17pm UTC](https://forum.dimagi.com/t/filter-multiple-choice-list-based-on-previous-question/8137/2 "2021-04-15T16:17:03Z")

</div>

Hi Christy,

To achieve this workflow, you'll need to use the [lookup tables feature](https://confluence.dimagi.com/pages/viewpage.action?pageId=12222793) to build dynamic multiple choice lists.

The result of your first lookup table (which I'll call #form/first) can then be used to [filter each item](https://confluence.dimagi.com/display/commcarepublic/Setup+a+Question+with+Filtered+Choices)from the second lookup table through the [selected() function](https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions#CommCareFunctions-selected).

Your filter would look something like

selected( #form/first, id)

to filter out any choices (by id) which weren't in the list of selected options from your first table.

-Clayton
