cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
dev_ken Occasional Visitor
Occasional Visitor

parameters inside parameter of an sql query using DocumentDB

  Hi,
I am new to Power Bi, Could anyone help with the particular scenario I am facing.
I am connecting to CosmosDB using DocumentDB.Connect.
Following is the query used for connection.
let    Source = DocumentDB.Contents(ConnectionUrl, DatabaseName, CollectionName,
[Query = "SELECT * from logs where date > ' "&StartDate&" ' and date < ' "&EndDate&" ' ORDER BY date"])
StartDate and EndDate are the parameters being used. This query executes fine.
When I make the part of the query containing parameters into another parameter as follows.
 
Source = DocumentDB.Contents(ConnectionUrl, DatabaseName, CollectionName,
[Query = "SELECT * from logs where date ' "&DateRange&" ' ORDER BY date"])
where DateRange is a parameter defined in Power BI as follows.
 
DateRange =  > ' "&StartDate&" ' and date < ' "&EndDate&" '
When this query is executed, Power BI throws the following error.
DataSource.Error: Syntax error, incorrect syntax near 'DateRange'.
Details:
List
Can anyone please point me towards how the substitutions or de-referencing is done in Power Bi and,
is it possible to use parameters with in parameters.
Thank you.