1

I have a query to check average response times over:

  1. Last 24 hours
  2. 24-192 hours
  3. The difference between them as a percentage

let requests0to24HoursAgo = requests
    | where timestamp > ago(24h)
    | summarize last0to24HoursAverageRequestDuration=avg(duration), id=1;
let requests24to192HoursAgo = requests
    | where timestamp > ago(192h)
    | where timestamp < ago(24h)
    | summarize last24to192HoursAverageRequestDuration=avg(duration), id=1;
let diff = requests0to24HoursAgo
    | join
        requests24to192HoursAgo
        on id
    | extend Diff = (last0to24HoursAverageRequestDuration - last24to192HoursAverageRequestDuration) / last24to192HoursAverageRequestDuration * 100
    | project
        ["Average response (last 0-24 hours)"]=last0to24HoursAverageRequestDuration,
        ["Average response (last 24-192 hours)"]=last24to192HoursAverageRequestDuration,
        Diff;
diff

This works perfectly in the Logs section in Azure, but as soon as I pin the query to a dashboard, it's unable to run it with the date range "Set in query" and returns NaN for 2 of the values.

When I click "Open Editing Pane", set it to "Set in Query" and run it, it works. When I then click "Apply", it is still broken on the dashboard.

enter image description here

enter image description here

GooseZA
  • 1,015
  • 1
  • 10
  • 19

2 Answers2

0

As per the documentation, In log analytics the default time range of 24 hours applied to all queries.

  • We have tested in our local environment, we tried overriding the time range parameter using the dashboard tile setting which didnt help the request you made looks like a feature request.
  • Would suggest you to submit a feedback forum & raise the same issue over Microsoft Q&A
VenkateshDodda
  • 4,723
  • 1
  • 3
  • 12
  • The thing is, these exact queries used to work. We recently migrated our services to a new region and the dashboards got recreated. Since then, the exact same query has been returning NaN's - So somehow, it used to work, but now does not. – GooseZA Aug 30 '21 at 06:59
0

I stumbled across the same issue when the timespan I set within the query (| where timestamp > ago(7d)) was ignored in the dashboard.

I've tested the way with the tile settings, like VenkateshDodda-MT mentioned:

  1. Open the tile settings in the dashboard (-> Configure tile settings)
  2. Tick Override the dashboard time settings at the tile level.
  3. Select a greater timespan than 24h

Although there is no Set in query option like in the query editor, it would be enough to set a timespan of 30 days in your case.

I've also successfully tested it with your query.

johnmoarr
  • 430
  • 3
  • 7