Hmmm… this is a tricky one, because Airtable unfortunately doesn’t give us programmatic access to those summary numbers that appear on the screen. This is one of my top feature requests for Airtable! I would recommend that you email them as well at support@airtable.com to request this as a feature.
You can probably accomplish this with a custom Javascript, but the JavaScript experts here would need to chime in on that one.
For my clients, I use Integromat’s Numeric Aggregator to loop through the records, group them by the group that I want, and then return the summary value for each group. But this is also quite the challenge to setup in Integromat as well — it takes several hours to fully craft this scenario in Integromat. (If you need help with setting this up in Integromat, I’m a Registered Integromat Partner and you can reach out to me via my website at scottworld.com).