How to create Aggregate Tables ? and pivot?

How to create a table aggregation in Grafana ?

Country Category Cost
Brazil A 100
China A 150
USA A 200
Japan B 100
Brazil B 0
China A 150
USA A 200
Brazil B 50
China B 400
USA B 200
Japan A 100
Total Cost 1650

Are you referring to adding a total cost row at the bottom? What datasource are you using?

Marcus