You can achieve this in Power BI without creating multiple measures by leveraging the built-in Matrix visual and DAX’s “Show Values as” options.
Here’s how you can do it:
-
Load your data into Power BI as a simple table (as in your example).
-
Create a Matrix visual:
-
Drag the Group field into the Rows area.
-
Drag the Type field below Group in the Rows area (to create a hierarchy).
-
Drag the Count field into the Values area and set the aggregation to Sum (default).
-
-
Enable subtotals to get the “Total” row for each group:
-
Click on the Matrix visual, go to the Format pane, and expand the “Subtotals” section.
-
Turn on “Row subtotals.” This will automatically show totals for each group, just as you expect.
-
-
No need to create extra measures—Power BI Matrix will sum up the counts by Group and Type, and add totals for you.