Min/max dynamic values for gauge with treshold of any missing

Hi,
I am working on my first Grafana dashboard and got to part that needs some dynamic parameters applied in the right place.

What I need is a Gauge with max value set from query and showing current value (from another query).

so I have two queries A & B:

then, in the Transform section, I have set the total value (query B) to be used as a ‘Min’.

requirement is simple: If current value is one less than total, the gauge has to show accordingly, for ex. if ‘total’ (B) is 3 and ‘current’ (A) is 2, then 2/3 of the gauge will be green and 1/3 red.

if total is 2 and current is 1m I need to have half gauge red and half green. I also need the legend showing it in format of ‘current {}/total {}’
now my Gauge looks like this:

can you tell me ,please, what to set and I’ll post result, I’m sure many will find this helpful!
Thanks!