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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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

Top Solution Authors