PowerQuery - Pass Parameter from Cell Value replacing Variable from T-SQL Script

JonReyno

Board Regular
Joined
Jun 8, 2009
Messages
130
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I am new to Power Query and I'm seeking some assistance. I have a script that I have created within SQL. Within the script, I have DECLARE'd and SET a variable for a 'Report Date'. This variable is used throughout the query and various date fields use this date.

Previously, when I have connected Excel to a SQL database, I create the script in SQL and then re-create it within Microsoft Query within Excel, so I can apply a parameter, but due to the complexity of this query, I'm not able to do that.

I can get the data to appear within Excel, but as soon as I try and create a parameter where the user can enter a date into a cell, it falls over. I have had various errors appear in different forms. The most common one appears to be around converting between a string and a date, but everything I have tried doesn't resolve it.

It's driving me a bit mad! So my question is, how can I get the report running based on the date that the user enters into a cell?

Any help would be gratefully received. I know nothing about DAX, so I can't seem to work out what I need to do. I foolishly thought it would be simple to resolve
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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