Here's a simple example to illustrate:
Load the Sales Data:
Import your sales data into Power BI.
Create the Matrix:
Select the Matrix from the "Build" pane.
Add Fields:
Case:1 Category - Subcategory
Drag the "Category" field to the "Rows" area.
Drag the "Sales" field to the "Values" area.
Drag the "Subcategory" field to the "Rows" area.
A matrix with automatic hierarchies will be created. Click on the "+" sign to expand the hierarchy. Click on the "-" sign to collapse the hierarchy
Case:2 Category - Region
Drag the "Category" field to the "Rows" area.
Drag the "Sales" field to the "Values" area.
Drag the "Region" field to the "Rows" area.
A matrix with automatic hierarchies will be created. Click on the "+" sign to expand the hierarchy. Click on the "-" sign to collapse the hierarchy
Case:3 Category - Region - Segment
Drag the "Category" field to the "Rows" area.
Drag the "Sales" field to the "Values" area.
Drag the "Region" field to the "Rows" area.
A matrix with automatic hierarchies will be created. Click on the "+" sign to expand the hierarchy. Click on the "-" sign to collapse the hierarchy
Tip
Try Clicking on drill up and drill down buttons to move to the next and previous levels of hierarchies.
Case:4 Category - Region - Segment (Rows) - Order Date (Columns)
Drag the "Category" field to the "Rows" area.
Drag the "Sales" field to the "Values" area.
Drag the "Region" field to the "Rows" area.
Drag the "Order Date" field to the "Column" area.
(Drag and drop year - quarter - month in column area)
A matrix with automatic hierarchies will be created. Click on the "+" sign to expand the hierarchy. Click on the "-" sign to collapse the hierarchy
Select Rows / Columns to move across
Customize:
Use the "Format" pane to adjust the Matrix appearance.