Power Query: Filtering of Choice Part 4
18 September 2024
Welcome to our Power Query blog. This week, I complete the solution to the challenge involving a choice of filters.
In this series, I am considering a filtering challenge. Essentially, I have a Table of data, Tbl_Sales_Data, shown below::
I will be filtering this data, by comparing values from one of these Tables, which have been named Tbl_Dates, Tbl_Amounts and Tbl_Person:
The choice of which Table to use is controlled by a dropdown, which has been given the Named Range P_Choice and another translation Table, Tbl_Translation:
In Tbl_Translation, the first column, Choice will link to the value from the dropdown. The second column Translation, then translates to a column from the data Table. All of the data has been entered manually and the results will be driven by the value selected in P_Choice.
Last week, I completed the transformations:
I am ready to load and test the solution. I choose to ‘Close & Load To..’ in order to control which queries are loaded to the Excel Workbook:
I choose to ‘Only Create Connection’ to begin with, and then I may right-click on the Tbl_Sales_Data query to access ‘Load To…’ again:
This time, I choose to load the data to a new worksheet:
My results are shown on a new sheet:
To test my query, I go back to ‘Sheet1’ and change the inputs:
Here, I choose to filter by the Date. I refresh the Tbl_Sales_Data query to see the results:
The correct dates have been selected. Finally, I select to filter on ‘Amount’:
When I refresh, the correct data appears:
Come back next time for more ways to use Power Query!