Difficulty getting stacking to work

I’m having trouble getting stacking to work for Windows data which is being send to InfluxDB from Telegraf. I cannot get the templating to work so that when I have 2 servers selected then I get the CPU usage for both overlayed on one graph.
This is the query for the Server variable (with the Multi-Value option ticked):

I have ticked the Stack option under Display > Stacking & Null Value

Here is what I am getting:

When I select a single server, the graph displays fine:

This is the query I’m running:
SELECT mean("Percent_Processor_Time") FROM "win_cpu" WHERE ("host" =~ /^$Server$/) AND $timeFilter GROUP BY time($__interval) fill(null)

If I do not use the templating variable and just use the server names themselves and create multiple rows, I get what I want but I want to be able to use a variable so servers can be selected rather than hardcoded in.

I am using Grafana version 5.4.3
InfluxDB version 1.7.3
Any help is appreciated.


Looks like i managed to fix it by using an additional group by clause to group by the host.

How do I get the host to appear at the bottom as an alias as the Server name. Currently it is appearing as follows:

$tag_host is what it needed for alias.

Managed to work it out for myself. Leaving here as it may help someone else!