Graph Panel as Series - MSSQL

Hi,
I’m hoping someone can help because I’m pulling my hair out, I’m not an SQL expert but I know enough to to be dangerous.

I can’t seem to get my Graph to display properly despite following the “Example with one value and one metric column” located here

Situation:
I am trying to pull out information out of a SQL database which runs a service desk. I want to have a series graph that has the techs name “v_rpt_Service.Resolved_By” as the metric, their average time to resolve “v_rpt_Service.Resolved_Minutes” as the value and the time series is taken from “v_rpt_Service.date_entered”

I have set the X-Axis Mode to “Series”

Every time I try to run the query it says “mssql: Column ‘v_rpt_Service.date_entered’ is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.”

I know it may be glaringly obvious but I’m stuck :frowning:

Apologies if I have posted this in the wrong spot, any help appreciated!

SELECT
v_rpt_Service.date_entered as time,
AVG(CAST(v_rpt_Service.Resolved_Minutes AS float)) AS Value,
v_rpt_Service.Resolved_By as metric
FROM
v_rpt_Service
WHERE
$__timeFilter(v_rpt_Service.date_entered)
GROUP BY
v_rpt_Service.Resolved_By

You need to group by both v_rpt_Service.date_entered and v_rpt_Service.Resolved_By and it’s usually a good idea to ORDER BY v_rpt_Service.date_entered in case the data are returned out of order on date without the order by.

In the documentation link you referenced there are heading named Example using the $__timeGroup macro: which is similar to what you want to do even though it’s using the __timeGroup macro function to put all points in buckets of 3 minutes each. If you just want ot visualize every timestamp you you have stored in table as a point in graph you don’t need the __timeGroup macro, but in cases where you’re looking at large time ranges and returning too many points it’s recommended to use the __timeGroup macro since Grafana can only handle the amount of points as the graph can render in total width (pixels).