You can do multiple groupings to calculate summaries and totals. See, for example, the Grouping section in ModernDive (link below)
http://moderndive.com/5-wrangling.html#groupby
Also, please try to use the reprex package rather than code + screenshots! It's much easier to go back and forth that what.
For pointers specific to the community site, check out the reprex FAQ.