Can't get stacked bar graphs working in grafana

hello,

I have recently been introduced to grafana to build a few reports and dashboards for our team. I have not been able to get the stacked bar graph working and was wondering if they are not fully implemented or there are some tricks to get them working. The same data in excel works perfectly.

this is what I like to achieve …
sample query:
select
now() as time
, fruit
, count()FILTER (where vitaminC=1) as VC
, count(
)FILTER (where vitaminD=1) as VD
, count(*)FILTER (where vitaminE=1) as VE
,…
from sampletable
group by fruit

and like to generate a stacked bar graph where groups are stacked on top of each other, see attached excel example. the datasource is postgres but I don’t believe that matters. I would greatly appreciate if you could provide some insight. thank you!

Hi,

It’s not possible to do this right now for non time-series data as you’ll need two things:

But these two options are not compatible for now. There is an issue open about this here: https://github.com/grafana/grafana/issues/7949 (you can add your thumbs up to push this feature, I added mine as I also think it’s important)