How to make such a group?

I have two entities: binary sensor A (possible values on/off) and history_stats sensor B (possible value 0, 1, 2, 3…).

Is it possible to make a group entity G by using A and B such that:
G is on: if A is on or B > 0
G is off: otherwise

Thanks

hello
why do you need a group?
i would do, a dummy switch and an automation somtehing like:
trigger:
{{ states(‘a’ , “on”) }}
conditon: and
{{ states(‘B’) |float) >0 }}
action:
turn dummyswitch on

That’s what I currently doing. One for on and one for off.
If that group can be created, it will be a little bit easier for me to use in node-red.