Redshift query issue for dashboard

Hello Grafana Team,
Good evening
Aim: we have one table called “mainfrontendevents” which is having multiple columns like user Id, customer name, browser name, etc.
Now, we want to make visualization in the form of time series metrics where we can visualize the user (userid) group by different browser names. Ex. Count of users for specific browser names like chrome, edge etc. So, in time series metrics we want as follows dimensions: X-axis: time Y axis: no of users Group by: browsername
We have integrated the AWS Redshift data source in Grafana. And to make a visualization of it, we have created one dashboard with the following SQL query:
SELECT
datetrunc(‘$time’,occurredat) AS datetime, browsername,
count(DISTINCT “userid") AS "usercount”
FROM mainfrontendevents
WHERE eventcode = 11000100 AND issandbox = FALSE
AND isbot = FALSE AND "ipid" IS NULL
AND occurred_at > (DATEADD($time, -$range, GETDATE()))
GROUP BY 1,2

We tried to implement the “Group by " attribute for the browsername in grafana but it is not working. we want to time series visualization from “browser-name” but in the panel, we get by "usercount”.

Try/improve this query:

SELECT
  $__timeGroup(occurred_at, $__interval),
  browsername AS "metric", 
  count(DISTINCT "userid") AS "usercount"
FROM mainfrontendevents
WHERE
  $__timeFilter(occurred_at)
  AND eventcode = 11000100 
  AND issandbox = FALSE
  AND isbot = FALSE 
  AND "ipid" IS NULL
GROUP BY 1,2
ORDER BY 1

See doc: Amazon Redshift plugin for Grafana | Grafana Labs

Thank you for your response

As per your suggestion, we tried this query but we got the same result we want the output mentioned in the screenshot.