Gauge max from variable count


I’m trying to get the percentage out of two queries from an elasticsearch data source, I believe this is not possible.
A workaround would be to use a Gauge and use a variable to set the max value.
Is it possible to get a count out of an elasticsearch variable and use it in the Gauge panel?