Display Stacked Series

Is there any way to stack different series of data.
Please see attached screenshots.
At the moment, series are displayed next to each other, not on the top of each other.


1 Like

Yes, combine your queries into one query. Use regex for the table name to combine those queries together.

An example:

1 Like

Could you please explain based on my 2 queries because it sounds very complicated to me :frowning:

SELECT sum(“value”) FROM “FRTMAP_TAGS_JC_DEPT_DEI” WHERE $timeFilter GROUP BY “year”, “week”


SELECT sum(“value”) FROM “FRTMAP_TAGS_JC_DEPT_DEX” WHERE $timeFilter GROUP BY “year”, “week”


Like this I think. This part of the regex (I/X) matches both I and X - the only difference between the two table names.

SELECT sum(“value”) FROM /FRTMAP_TAGS_JC_DEPT_DE(I/X)/ WHERE $timeFilter GROUP BY “year”, “week”

No quite :frowning:

error parsing query: error parsing regexp: missing closing ): FRTMAP_TAGS_JC_DEPT_DE(I at line 1, char 25

oh sorry - typo:

SELECT sum(“value”) FROM /FRTMAP_TAGS_JC_DEPT_DE(I|X)/ WHERE $timeFilter GROUP BY “year”, “week”

This: (I/X) should be (I|X) The pipe symbol means OR.

Thanks !
SQL works without any errors but graph still not displayed as stacked despite Stack box is ticked :frowning:

You can group by tag - if you have a unique tag value per table?

Sorry, I don’t follow you.
I already Group By Year and month …

You don’t know what tags are? Here are some docs to learn more about InfluxDB:

I just figured it out. You are not using time mode:


Stacking does not work in series mode. As you are grouping by time, I’m not sure why you would use series mode?

Also, you can group by time with InfluxDB so don’t think you need to make special tags for year, month. But maybe you have a special case that requires them?

I use year, month and week time because I want to filter by week (Monday to Sunday), month (whole month, not 30 days with InfluxDB…)-… etc.
InfluxDb and Grafana don’t give the flexibility to filter by full month … You can use 30 days … but some months are 30 days, 31 days, 28 and even 29 for February.
By using months and week tags, I can group my data correctly.

This is also why I use the Serie Mode … when the Timefilter is not practical.

If you use Series mode, then stacking will not work unfortunately.

Shame :frowning:
Any plans to make it work ?
Any suggestions how I could achieve this ?
Thanks for your help.

Have you find solutions at your problem ?

Does anyone have solution yet?

Hi! I have the same needs… is there any solution??

I’m struggling already for 2 days with the same thing.
I have for my electricity in my mysql DB every month a DB entry like this:
| ID | datum | T1 | T2 |
| 1 | 2020-05-15 01:00:00 | 600 | 800 |

Now, I want to do a dashboard, where I see for every month those 2 values stacked (how many from that month electricity usage is HighTarif, and how many LowTarif)

The stacking works for Time series, but then I cannot create a graph with MonthNames on X axis.
GROUP BY MONTHNAME(datum); is not working there

when I switch to series and use

datum as “time”,
MONTHNAME(datum) AS “metric”,
FROM elektro

I get

But I need to stack the T1 and T2 values for each month.

Any idea how to do it?

I have the same issue, any help please?

I have the same issue. I have three series that I want to show stacked. I want to show a monthly metric of 3 different entity types.