Filtering based on a dropdown list in Power Query

stags81

New Member
Joined
Dec 10, 2010
Messages
19
Hello,

I am using Power Query to pull multiple data sets into a single workbook. I have a table within that workbook that contains a dropdown. What is selected in that dropdown determines how the data pulled in by Power Query gets filtered. See attached for further explanation.

It works perfectly, but I'd like to take it to the next level. If a user selects "All" in the dropdown, I would like Power Query to simply disregard the input variable and display all rows. Is this possible to write in M code?

e.g.
#"Filtered Rows" = Table.SelectRows(#"Reordered Columns1", each if ([Supplier Name] = "All" then Table.DisplayAll else [Supplier Name] = Supplier)),

If more info is needed, please don't hesitate to ask. I'm just trying to be mindful of the information I share here.

Thanks in advance,

Mike
 

Attachments

  • Capture.JPG
    Capture.JPG
    241 KB · Views: 235

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Power Query:
#"Filtered Rows" = if Supplier = "All" then #"Reordered Columns1" else Table.SelectRows(#"Reordered Columns1", each [Supplier Name] = Supplier),
 
Upvote 0
Solution

Forum statistics

Threads
1,223,713
Messages
6,174,043
Members
452,542
Latest member
Bricklin

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