Correctly Setting Gauge Maximum Based on Total of Constituent Values

I am recording a bunch of power data in InfluxDB from a bunch of devices.

I want to query the last value reported for each device, sum them, and show them as a simple gauge indicating current power usage.

My simple query looks like:

SELECT last("value")
FROM "power"
WHERE $timeFilter
GROUP BY "entity_id" fill(previous)

I select “gauge” as my visualization. I have “calculation” set to “Total”.

It almost works. I get a properly summed value, but the range on the gauge is too small. If the total value is, say, 31, the maximum range on the gauge will still only be something like 16, or whatever underlying values are contributing.

How do I get the range set large enough?

(Also, how do I get the range so it doesn’t clip…)

I’ll add: ideally, the max would actually be something based on the max value from the past 24 hours, or something.