How to add trend line to time series graph from psql?

Grafana v10.4.0 (03f502a94d)

I want to create a trend line on my time series graph that I am getting data from psql.

This is my query I use to select data:
SELECT time, SUM(disk_used_gb) AS “Total Disk usage”
FROM disk_usage
GROUP BY time
ORDER BY 1;

Is there anyway to add a trend (liner regression) line to this graph?

You may try Grafana’s Regression analysis transformation:

To be able to use it you need to enable regressionTransformation feature toggle:

[feature_toggles]
enable = regressionTransformation
3 Likes

Thank you! That works!!

Is there anyway, to keep this trend line going for future dates?