Here’s how to do it:
- Select your data and go to the 'Visualizations' pane. Select the 'Matrix' chart.
- Go to the 'Format' pane.
- Turn 'Column Subtotals' ON.
- Turn 'Row Subtotals' ON.
- Power BI automatically adds subtotals for the Row and Column groups.