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: 237

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
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,224,755
Messages
6,180,771
Members
452,996
Latest member
nelsonsix66

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