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


Board Regular
Jun 8, 2009
Office Version
  1. 365
  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

Some videos you may like

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Watch MrExcel Video

Forum statistics

Latest member
Phillip Rogers