Graph not showing in increasing/decreasing order based on time

Hi,

My timeseries graph is not showing as increased or decreased please help to resolve the issue based on inc/dec order.

Hi,

What data source? If MySql or Postgres please make sure that you order the result by time.

Marcus

Datasource is POSTGRES

Please refer to time series queries in using PostgreSQL in Grafana documentation. Look at the example where order by are used.

Marcus

This is my query:
SELECT
recorded_date as time,
sum(active_count) as sumofactivedevices
FROM
production.device_kpi_summary_active_daily
WHERE
$__timeFilter(recorded_date) group by time;

Same but still not showing in increased order.

If recorded_date not is an epoch value you should use the macro function $__timeSec(recorded_date). I don’t think recorded_date is epoch since you’re using it in the where expression with the macro function $__timeFilter - is my assumption correct?

And as I said earlier you should order your result with the order by:

SELECT
  $__timeSec(recorded_date),
  sum(active_count) as sumofactivedevices
FROM
  production.device_kpi_summary_active_daily
WHERE
  $__timeFilter(recorded_date) 
GROUP BY time
ORDER BY time

Please let me know if this works

Marcus

Yes its working .Thanks Marcus