Creating Stacked Bar Charts on Grafana using data from SQL Server

As I understood it he needs help with how to write the sql query to support his use case and that’s why I did think you’re answer was a bit out of scope - but you’re right it shows how to configure the graph panel to display according to his use case.

@adsingh A query like this should be able to solve it:

SELECT
  $__timeGroup(<your time column>, '24h') as time,
  <category column> as metric,
  count(<id column?>)
FROM
  <table>
WHERE
  $__timeFilter(<your time column>)
GROUP BY
  $__timeGroup(<your time column>, '24h'),
  <category column>
ORDER BY 1
1 Like