Stacked bars next to each other from 2 different sources

Hi,

I query two different databases with similar data but organized differently. My goal is to compare the values between databases in a fairly fine way, both per year and by category.

  • What Grafana version and what operating system are you using? v11.1.3

  • What are you trying to achieve? Display two stacked bar chart to compare data from 2 different databases.

  • How are you trying to achieve it? I have 2 queries, each one queries a different database. The result of each query is a 3-column table: year, category, value. I want to display the two datasets in the form of bars: for each year, one bar per database (so 2 bars for each year) and for each bar, a stack of values according to the “categories”. So I would ideally need to cross the two results tables according to the year AND category fields.

  • What happened? I can display the values in the form of bars with the year on the X axis, but there are as many bars as categories, while it will take only one bar per database, so per query.

  • What did you expect to happen? For each year, one bar per request and for each bar a stack by “categories”.

  • Did you follow any online instructions? If so, what is the URL? I watched this post ( Can't get side-by-side bar graph with multiple series - #4 by koenwindey ), but the solution does not allow to display stacked bars side-by-side.