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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
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,214,925
Messages
6,122,301
Members
449,078
Latest member
nonnakkong

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