Forum Discussion

user_2020's avatar
user_2020
Copper Contributor
Jul 11, 2020
Solved

PowerQuery -How to apply a parameter to all tabs within a spreadsheet

I am using excel 2016. I created 8 separate tabs in a spreadsheet, each tabs connects to a different table on MS SQL server(ODBC). I apply the exactly same filter (with same inventory number and sales...
  • OwenPrice's avatar
    OwenPrice
    Jul 12, 2020

    user_2020 

    One approach to using a list of values as a filter is to create a filter table and use Merge with an inner join to filter the queries.

     

    I created a filter table on a separate sheet in my workbook and put two countries in there:

     

    Now I select the PopulationStatistics query and use Home>Merge Queries and configure it like this:

     

    Because I'm using an inner join, this has the effect of removing rows from the PopulationStatistics table that don't exist in the CountryFilter query.

     

    This will add a column to the right of the PopulationStatistics query called CountryFilter, but we don't need that, so just right-click it and select Remove.

     

    I then repeat the whole merge process for the LandUse query (or whatever other query has country in it), then use Home>Close&Load.

     

    When the Close&Load has finished, you can delete the additional sheet created for the filter query so that you just have one sheet for each of your original queries and one sheet for your filter table and the list of queries will show "Connection only" against the filter:

    Now, when you change the rows in the filter table (add/remove/edit), you can refresh all queries to re-filter them.

     

Resources