Power query question

Jing

Active Member
Joined
Feb 11, 2011
Messages
289
I have the following query and i am trying to find a way to have it pull the date range for start and end dates from cells within the workbook but am not sure how to do that...

= Sql.Database("server name", "data info", [Query="SELECT Group_Name, Interval_DateTime#(lf),R_ReqHrs as [Original Req Hrs]#(lf),R_advFlex as WeekOutRamp#(lf),R_DayFlex as DayOfFlex#(lf),R_AdjReqHrs as AdjustedReqHrs#(lf),R_FlexHrs_Total as TotalFlexHrs#(lf)FROM FINAL#(lf)where [B][U]Interval_DateTime >= '2022-10-11' AND Interval_DateTime <= '2022-10-18'"])[/U][/B]

Right now it is manually entered into the query but if i can get the dates to change from say start date = A1 and End date = B1 that would be amazing!
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Load each of the cell (for instance using named ranges) into PQ as a separate query. Be sure to drill down on the value.
Then refer to these querynames as parameters in the string you build.
 
Upvote 0

Forum statistics

Threads
1,223,516
Messages
6,172,778
Members
452,477
Latest member
DigDug2024

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