I am not sure if I get your question.
I think this query should work
"select country, state, city, SUM(sales), SUM(profit) from foo group by country, state, city with rollup;"
for a table with country, state, city, sales, profit as columns
"select country, state, city, SUM(sales), SUM(profit) from foo group by country, state, city with rollup;"
for a table with country, state, city, sales, profit as columns