Dynamic series in one query

Hey! Is there a way to get multiple series in one query using Postgres connection? Let’s say I have 5 attributes associated to my data and I’d like to display 5 series using one query so it’s dynamic. When one attribute is added or removed, so is done with series.


GROUP BY created_at, attribute
ORDER BY created_at;

and attribute has distinct values (1, 2, 3, 4) so I get 4 different series, each showing data for specific attribute’s value using some kind of similar query


Referring to documentation, have you tried selecting attribute as metric?


Yup, It works with that. Thanks

Hi, I have the same issue.
I have a query that returns a result like this:

Col 1. Col2. Col3.
“Forks” 35 “React.js”
“Forks” 19 “Vue”
“Forks” 27 “JQuery”
"Github Stars” 19 “React.js”
"Github Stars” 62 “Vue”
“Github Stars” 24 “JQuery”
“Watchers” 63 “React.js”
“Watchers” 86 “Vue”
“Watchers” 74 “JQuery“

I need to create a chart like this: https://play.grafana.org/goto/zuACxFV7k?orgId=1.

My query returns all data and I can’t show all bars, reading the documentation I don’t find a method to split the result in more series. I created multiple queries, for each serie, but I don’t know make these queries dynamic, i.e. based on a dashboard variable.