Separate count result by instance variable

I’m using grafana 8.3.3 on freeBSD 13.1 and collecting node exporter data from that server + 2 other freebsd machines using prometheus on the same machine grafana is installed.

I’m using a node_exporter dashboard I found(forgot which exactly, been a while) and I am now modifying it to display all 3 machines into 1 dashboard but every query that uses a count only display 1 result instead of 1 result per instance.

For example, using this query:

count(count(node_cpu_seconds_total{instance=~"$node_instance"}) by (cpu))

To count the number of cores a cpu has will only return the highest core count of the 3 instead of doing it for each computer. Seems odd to me that it doesn’t separate by instance but I guess that since it’s a separate function, it just counts everything and return 1 result.

My current workaround is to duplicate that query to have 3 and manually specify the value of $node_instance which then give me the result I expect but I’d rather avoid doing it this way in case I decide to add more computers in the future.

Is there any better way I could be doing this without having to manually specify each different instance?