Need help with dynamic Filtered Row in Power Query

asecgeek

New Member
Joined
Apr 1, 2016
Messages
18
I have a worksheet with a pivot table displaying sales data. There is a named Named Range called SalespersonID. When I enter a Salesperon's ID and click a button, the Power Query refreshes, and the pivot table displays the data filtered data. I do this by having Filtered Row formula step in the Power Query read = Table.SelectRows(dbo_company_Quad_Report, each ([salesrep_id] = SalespersonID)) This works great.
  1. I'd like to have a way to include the option to "show all", which can be done manually by a) removing the Filtered Row step. or b) by setting Filtered Row step to = Table.SelectRows(dbo_ashw_Quad_Report, each true) but I don't know how to achieve this from a button on the worksheet.
  2. I know I could just leave out the "Filtered Row" step -- thus showing all rows -- and have users apply filters on the pivot table, but this is NOT what I want.
Any help is appreciated.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
You should be able to accomplish this by modifying the M-code to read as:
= Table.SelectRows(dbo_company_Quad_Report, each ([salesrep_id] = SalespersonID or SalespersonID = null ))

Then when no SalespersonID is supplied, SalespersonID = null, reverts to null = null which is a true statement
 
Upvote 0
Solution

Forum statistics

Threads
1,223,666
Messages
6,173,672
Members
452,527
Latest member
ineedexcelhelptoday

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