How to filter SharePoint lists dynamically

SharePoint List web part available in modern SharePoint pages is provided with a filtering option that allows you to dynamically filter the data from one list using data stored in another list.

In this article I will show you how you can take advantage of this feature with, explaining all the steps using a predefined scenario to filter the company offices based on their location.

Filter SharePoint Lists dynamically

Environment: Before we jump into the lists web part configuration you must know the lists schemas so you can recreate them in your environment.

Offices:
  • Title – Single line of text
  • City – Single line of text
  • Address – Multiple lines of text
Locations:
  • Title – Single line of text
  • Photo – Image

  1. Start by adding two List web parts to a SharePoint page
    Filter SharePoint Lists dynamically
  2. In one of the web parts select the Office lists and in the other one select the Locations list
  3. Edit the web part showing the Office list and turn on the Dynamic filtering option
  4. Select City in the Column in Offices to filter
  5. Select Locations in the List or library containing the filter value
  6. Select Title in the Column containing the filter value
    In the following image you will notice that my title column has been renamed to City, this was made to make the relation between both lists easy to understand. If you don’t know how to rename the default title column have a look here.
    Filter SharePoint Lists dynamically
  7. Click Apply and save your page

In the following animation you can see how the Location list filters the data in the Offices list dynamically on click.

Filter SharePoint Lists dynamically

Note: The locations column is using the gallery view that was defined as the default view for the lists. To learn how to define the gallery view as default view in your lists have a look here.

Now that you understood how the dynamic filtering works, adjust the scenario to your requirements and start filtering the data in your lists.


4 Responses to “How to filter SharePoint lists dynamically”

  1. Melissa Korzun

    April 1, 2022

    This is a lovely solution, and I’ve follow it. However, when a user clicks the card instead of the circle, it opens a link to the filtering list, rather than filters the webpart. Is there any way to prevent that?

    Reply
    • João Ferreira

      April 27, 2022

      Hi Melissa,

      The only solution to solve the issue would be to create a custom list formatting with JSON to make it easier to click in the selector.
      Check out the video in the link below to see an example from one of sessions about Microsoft Lists.
      https://youtu.be/0teoVYxEGLI?t=1831

      Have a nice day

      Reply
  2. ben

    April 5, 2022

    Is there a way to make it so you can click anywhere on the gallery image to filter>! By default it opens that gallery item unless you click right in the little circle which is pretty poor user experience..

    Reply
    • João Ferreira

      April 27, 2022

      Hi Ben,

      The only solution would be to create a custom list formatting with JSON to make it easier to click in the selector.
      Check out the video in the link below to see an example from one of sessions about Microsoft Lists.
      https://youtu.be/0teoVYxEGLI?t=1831

      Have a nice day 🙂

      Reply

Leave a Reply to João Ferreira


I've been working with Microsoft Technologies over the last ten years, mainly focused on creating collaboration and productivity solutions that drive the adoption of Microsoft Modern Workplace.