Forum Discussion
User controlled parameter in Kusto Query
- 1 year ago
felixcheah , Try using
TimeSeriesData
| where TimeSeriesId == "NZSiHist;nsu=urn:GEHistorian:HDAServer:BuildingModel;s=Elec_DukeTA3.Tag"
| where Timestamp between (datetime({{StartTime}}) .. datetime({{EndTime}})) - 1 year ago
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.
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.