Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

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.
0 REPLIES 0

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.