You would have to write an SQL Query for getting the results in your desired format -
where you create the columns dynamically filtered and grouped and totals section.
There's no functionality to edit pivot tables' formatting.
For more info contact - anirudh2395@gmail.com
@Anirudh23
Pivot tables are only available to simple and custom questions with summarized data. They don’t work for questions that lack aggregate data, and they don’t work for questions written in SQL, as Metabase would need to modify your SQL code in order to calculate subtotals