Providing dynamic date range to PowerQuery

BobG999999

New Member
Joined
Aug 11, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
I have been looking for a while now, and while I've gotten close, I haven't found that cigar.

I have a PowerQuery gathering transactions from multiple worksheets in a file, and I'd like to be able to filter to get only those transactions with dates between a StartDate and an EndDate. I've gone through several instructions that talk about how to have dynamic filtering, but none that specifically deal with a date range. When I setup some tables per those instructions, I Drilldown to convert the field into text, then go back to my main table and set the filter on the Date field to "between". If I try to edit the M code to use the StartDate and EndDate tables, I get the following error, where "StartDate" and "EndDate" are the single row tables with the desired dates that can be changed.


1628689602282.png


If I am going about this wrong, I hope someone can let me know and show me how to do it.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Set the same data types on the columns you filter and the variables defined. According to the error message it is not the case.
StartDate and EndDate need to be defined as datetime.
 
Upvote 0
Solution
Glad I could help. The error message was a giveaway ?. And thanks for the mark.
 
Upvote 0

Forum statistics

Threads
1,215,883
Messages
6,127,545
Members
449,385
Latest member
KMGLarson

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