Using a cell value to filter records by date

TheWennerWoman

Active Member
Joined
Aug 1, 2019
Messages
301
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am new to PowerQuery but learning fast :)

I have created two parameters (connection only) for my period_from and period_to - these will be dates.

I have fetched data from SQL and filtered the date to only return one day - I was hoping to then go into the M code and substitute the value in there with one of mine (well that's how they show you to do it on YouTube).....but in the M code I see this:
Code:
= Table.SelectRows(Source, each ([posteddate] = #datetime(2021, 4, 7, 0, 0, 0)))

What do I need to do next?

Thank you in advance.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Ok, I have made some progress.
Code:
= Table.SelectRows(#"Changed Type", each ([posteddate] = PFrom))

gets me one day's worth of data; what do I need to do to get a date range?

I thought
Code:
= Table.SelectRows(#"Changed Type", each ([posteddate] >= PFrom), ([posteddate] <= PTo))

but it errors with Expression Error - there is an unknown identifier?
 
Upvote 0

Forum statistics

Threads
1,223,714
Messages
6,174,055
Members
452,542
Latest member
Bricklin

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