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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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,215,009
Messages
6,122,674
Members
449,091
Latest member
peppernaut

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