I am trying to use a cell value(Parameter), the same as I use with Microsoft query, but it is not working.
Example: Select * from table where Date = ?
Using Power Query
Defined the Criteria
let
Source = Excel.CurrentWorkbook(){[Name="AsOfDateCriteria"]}[Content],
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"AsOfDate", type date}}),
ANDCriteria01 = Record.Field(#"Changed Type"{0},"AsOfDate")
in
ANDCriteria01
Sql Query
let
ANDCriteria01 = AsOfDateCriteria,
Source = Sql.Database("plrs-sql", "polaris", [Query="SELECT * FROM Polaris.dbo.MyTable Where AsOFDate = AsOfDateCriteria"])
in
Source
Error
Message=Invalid column name 'AsOfDateCriteria'.
The first step shows the value of 04/11/2019.
Example: Select * from table where Date = ?
Using Power Query
Defined the Criteria
let
Source = Excel.CurrentWorkbook(){[Name="AsOfDateCriteria"]}[Content],
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"AsOfDate", type date}}),
ANDCriteria01 = Record.Field(#"Changed Type"{0},"AsOfDate")
in
ANDCriteria01
Sql Query
let
ANDCriteria01 = AsOfDateCriteria,
Source = Sql.Database("plrs-sql", "polaris", [Query="SELECT * FROM Polaris.dbo.MyTable Where AsOFDate = AsOfDateCriteria"])
in
Source
Error
Message=Invalid column name 'AsOfDateCriteria'.
The first step shows the value of 04/11/2019.