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

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

billszysz

Active Member
Joined
Feb 26, 2014
Messages
384
Office Version
  1. 365
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,190,958
Messages
5,983,843
Members
439,866
Latest member
jh3268

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
Top