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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
felixcheah
Frequent Visitor

User controlled parameter in Kusto Query

I have a ADX query that queries an ADX database with Timeseries data. I want the users to be able to define a time range for that query. Is that possible?

 

For example a Query like:

TimeSeriesData
| where TimeSeriesId  == "NZSiHist;nsu=urn:GEHistorian:HDAServer:BuildingModel;s=Elec_DukeTA3.Tag"
|where Timestamp between(StartTime .. EndTime)
 
Where StartTime and EndTime are defined in the Power BI Report

 

2 ACCEPTED SOLUTIONS
bhanu_gautam
Super User
Super User

@felixcheah , Try using

TimeSeriesData
| where TimeSeriesId == "NZSiHist;nsu=urn:GEHistorian:HDAServer:BuildingModel;s=Elec_DukeTA3.Tag"
| where Timestamp between (datetime({{StartTime}}) .. datetime({{EndTime}}))




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

rohit1991
Super User
Super User

Hi @felixcheah ,

 

Yes, it is absolutely possible to allow users to control parameters like StartTime and EndTime in a Kusto Query (ADX) within Power BI by using report-level parameters or Power Query parameters that are passed dynamically into the Kusto query. In Power BI, you can create parameters for StartTime and EndTime, and then use them to construct your KQL query dynamically in Power Query.

 

Alternatively, if you're using DirectQuery mode, you can bind slicers or date pickers in the report to filter values and use the let statements in your Kusto query to pass those filter values. For example, you can define let StartTime = datetime(@StartTimeParameter); and use that in your query to filter the time range. This approach allows users to interactively select their desired time window, making the report more flexible and user-driven.

 

Passionate about leveraging data analytics to drive strategic decision-making and foster business growth.

Connect with me on LinkedIn: Rohit Kumar.

View solution in original post

5 REPLIES 5
v-menakakota
Community Support
Community Support

Hi @felixcheah ,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you.

Hi @felixcheah ,

I wanted to check if you had the opportunity to review the information provided by @bhanu_gautam  and @rohit1991 . Please feel free to contact us if you have any further questions. If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

Thank you.

Hi @felixcheah ,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you.

rohit1991
Super User
Super User

Hi @felixcheah ,

 

Yes, it is absolutely possible to allow users to control parameters like StartTime and EndTime in a Kusto Query (ADX) within Power BI by using report-level parameters or Power Query parameters that are passed dynamically into the Kusto query. In Power BI, you can create parameters for StartTime and EndTime, and then use them to construct your KQL query dynamically in Power Query.

 

Alternatively, if you're using DirectQuery mode, you can bind slicers or date pickers in the report to filter values and use the let statements in your Kusto query to pass those filter values. For example, you can define let StartTime = datetime(@StartTimeParameter); and use that in your query to filter the time range. This approach allows users to interactively select their desired time window, making the report more flexible and user-driven.

 

Passionate about leveraging data analytics to drive strategic decision-making and foster business growth.

Connect with me on LinkedIn: Rohit Kumar.

bhanu_gautam
Super User
Super User

@felixcheah , Try using

TimeSeriesData
| where TimeSeriesId == "NZSiHist;nsu=urn:GEHistorian:HDAServer:BuildingModel;s=Elec_DukeTA3.Tag"
| where Timestamp between (datetime({{StartTime}}) .. datetime({{EndTime}}))




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

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