Power query dynamic filter between two values

gargamalebarbosa

Board Regular
Joined
Aug 4, 2022
Messages
118
Office Version
  1. 365
Platform
  1. Windows
Hi ,
Ihave a table like that. I need a dynamic filter in power query.
İ want to filter "Point" column with min/max criterias in cells F1- F2 values.

Thank you,

File Link







1667336433789.png

File link
 
Last edited:

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Very unclear, especially since the Min and Max are wrong.
That said, the PDF breaks the table into 2 pages. Page 1 has 4 columns as shown above with no columns separating, and page 2 with only the first 2 columns of page 1.

Using Power query it's simple enough to combine both tables into a single table of 62 rows, but the Min Max in the PDF is not just inaccurate but unneeded. Those values can be extracted from the main table and loaded as shown above, but as I said it's unclear what you want your end product to be.

Please use XL2BB when posting data.
 
Upvote 0
So here's the solution.
Book1
ABCDEFGHI
1PersonnelPointsMinMaxPersonnelPoints
2Gage Lavoie652575Gage Lavoie65
3Shyanne Blaney36Shyanne Blaney36
4Alfonso Crawford93Ayden Hough38
5Ayden Hough38Shayla James64
6Tony Breton83Derick Ferreira41
7Tristan Roderick76Jenny Cranstoun72
8Shayla James64Giancarlo Bustos63
9Taniya Graham85Payton Byington75
10Derick Ferreira41Ayana Rodríguez39
11Jenny Cranstoun72Angel Peterson33
12Giancarlo Bustos63Franklin Dalton53
13Payton Byington75Quinn Roderick27
14Daniella Collins95Omari Rynders33
15Ayana Rodríguez39
16Angel Peterson33
17Franklin Dalton53
18Quintin Durham94
19Quinn Roderick27
20Tessa Clough79
21Omari Rynders33
Sheet3


Blue tables are manually created tables, green table is from Power Query.

Put the Min and Max values in their own tables. Bring each in and just Drill Down to the value. The Query names you use are now the values in the Table Cell. Then bring in the table, filter it manually using "Between", then replace the minimum value in the M Code with the name of the Minimum Query, and then the maximum value in the M Code with the name of the Maximum Query:
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="tblPoints"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Personnel", type text}, {"Points", Int64.Type}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Points] >= tblMin and [Points] <= tblMax )
in
    #"Filtered Rows"
Code for the Minimum Table - Query named tblMin:
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="tblMin"]}[Content],
    Min = Source{0}[Min]
in
    Min
Same thing for Query tblMax.

Change the values in the Min and Max tables and Refresh All to update. You CAN make the Min and Max value cells use a Data Validation list to narrow the scope of the two variables as well.

You could also use Data Validation in a single cell with a Named Range and pull just that in, but I wanted to keep this simple for now.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,400
Messages
6,171,891
Members
452,431
Latest member
TiffanyMcllwain

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top