How do I calculate moving averages with iDBQuery?
Ask iDBQuery 'Plot daily revenue with a 7-day and 30-day moving average.' It smooths the series over your chosen windows across your data, returns the trend lines as a chart, and cites each point back to the source rows so you can see the signal under the noise.
A moving average smooths a noisy series by averaging each point with its neighbours over a rolling window, making the real trend visible under daily volatility. iDBQuery adds them from a plain request, no window-function SQL to write.
- You'd ask iDBQuery: 'Plot daily orders for the last 90 days with a 7-day and 30-day moving average on the same chart.'
- It computes each rolling average over your chosen windows, returns the raw series with the smoothed lines overlaid, and provides the values in a table.
- Each point is cited to its source rows, so the smoothing is grounded in real, auditable data rather than a black-box curve.
Moving averages are how you tell a genuine shift from daily noise, and the crossover of a short and long average is a classic momentum signal. Ask follow-ups in the same thread: 'When did the 7-day cross above the 30-day?' or 'Do the same for revenue by region.' iDBQuery keeps context and reworks the chart. Because it shows its SQL, an analyst can switch to a weighted or exponential average in one follow-up. This pairs with seasonality and trend analysis for reading direction, and with run-rate for projecting forward. Save it as a live report, and let the Analyst agent flag when a smoothed trend genuinely changes direction, citing the rows.
Updated 2026-06-22