I want to visualize some data in map and thereby I used workbook. I have not set the time range in the query since the time range should be configurable in the dashboard. After pinning the particular tile to the dashboard, the map would not get updated when the time range is changed. When I change the time range in the workbook it worked as expected though.
Please find the Kusto query that I tried in the workbook:
let mainTable = union customEvents
| extend name =replace("\n", "", name)
| where iif('*' in ("*"), 1 == 1, name in ("*"))
| where true;
let queryTable = mainTable;
let cohortedTable = queryTable
| extend dimension = client_CountryOrRegion
| extend dimension = iif(isempty(dimension), "<undefined>", dimension)
| summarize hll = hll(itemId) by tostring(dimension)
| extend Events = dcount_hll(hll)
| order by Events desc
| serialize rank = row_number()
| extend dimension = iff(rank > 5, 'Other', dimension)
| summarize merged = hll_merge(hll) by tostring(dimension)
| project ['Country or region'] = dimension, Counts = dcount_hll(merged);
cohortedTable
Your input on this is really helpful. Thanks in advance
In order for the query to update when the dashboard time range updates, the query in the workbook needs to use a time range parameter:
https://learn.microsoft.com/en-us/azure/azure-monitor/visualize/workbooks-overview#dashboard-time-ranges
You'll need to update your workbook to have a time range parameter, then update that query step to either use that time range parameter in the query text, like
or by choosing the time range parameter from the time range dropdown in the UX when editing the query (for logs based queries, if this is a query to the ADX data source where time range isn't a field in the ux, you have to use the time range parameter in the query text)
If you pin query step that uses a query like this (referencing a time range parameter) to a dashboard, then the dashboard knows how to "inject" the dashboard's time range into the query. (Without a time range parameter, there are various (naïve) ways we could try to inject a time range, but depending on exactly what the query does, there's a chance the query works but is not correct)
See the time range parameter link above for details on the ways you can use time range parameters, and the various syntax available, there are ways to get things like the start, end, duration, bucketing, etc, for a time range in the parameter syntax.