Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.

Reply
ERing
Post Partisan
Post Partisan

Possible to produce this Matrix visual in Power BI?

I've been assigned a new report to migrate from Excel to Power BI. I've created a dummy Power BI file (link below) that uses the same data structure as my real report.

I previously had a similar report and the solution required using a disconnected table. My Fact table structure and expected Matrix visual are a little different from my previous report and I'm struggling to adapt that solution to my current requirement.

Specifically, I would like to know:

1. How can I create a row grouping like in column B (Jobs Ran & Tech Labor Hours)?

2. How do I write my measures so that the MTD and Prior Year are in rows like column C3 through C8 and I have column headers like in D2, E2, F2, & G2?

3. Is it possible to add in a column with with comments like in G3?

Please let me know if I can provide any additional detail or clarification.

Power BI Dummy File 

Expected Result.png

1 ACCEPTED SOLUTION
johnbasha33
Super User
Super User

@ERing 

Thank you for sharing your Power BI file. Based on your objectives, here's how you can achieve the desired matrix layout:

---

### 1. Creating Row Groupings like “Jobs Ran” & “Tech Labor Hours”

To replicate the hierarchical row structure:

1. **Create a Disconnected Table**: Define a table (e.g., `MetricSelector`) with columns for `MetricGroup` and `MetricName`.

| MetricGroup | MetricName |
|--------------------|----------------|
| Jobs | Jobs Ran |
| Tech Labor Hours | Labor MTD |
| Tech Labor Hours | Labor PY |

2. **Load into Power BI**: Import this table without establishing relationships to other tables.

3. **Use in Matrix Rows**: In your matrix visual, set `MetricGroup` and `MetricName` as row fields to achieve the desired grouping.

---

### 2. Displaying MTD and Prior Year in Rows with Business Units as Columns

To structure your matrix with metrics in rows and business units in columns:

1. **Create a Measure**: Define a measure that switches values based on the selected `MetricName`.

```DAX
MetricValue =
SWITCH(
SELECTEDVALUE(MetricSelector[MetricName]),
"Jobs Ran", [JobsRanMTD],
"Labor MTD", [LaborHoursMTD],
"Labor PY", [LaborHoursPY]
)
```

Ensure that `[JobsRanMTD]`, `[LaborHoursMTD]`, and `[LaborHoursPY]` are existing measures in your model.

2. **Configure Matrix Columns**: Set `BusinessUnit` or the relevant dimension as the column field in your matrix.

3. **Set Values**: Use the `MetricValue` measure as the value field in the matrix.

---

### 3. Adding Comments to the Matrix

While Power BI's native matrix visual doesn't support direct input of comments per cell, you can implement comments using tooltips:

1. **Create a Comments Table**: Define a table with columns such as `MetricName`, `BusinessUnit`, and `Comment`.

| MetricName | BusinessUnit | Comment |
|--------------|--------------|--------------------------------|
| Jobs Ran | Unit A | High performance observed. |
| Labor MTD | Unit B | Slightly below target. |

2. **Establish Relationships**: If necessary, create relationships between the comments table and your existing tables based on `MetricName` and `BusinessUnit`.

3. **Create a Tooltip Page**:
- Add a new page to your report.
- Set the page size to Tooltip and enable the tooltip option in the page information.
- Design the tooltip to display the `Comment` field appropriately. ([How to write comments for some or every values in matrix or any ...](https://community.powerbi.com/t5/Desktop/How-to-write-comments-for-some-or-every-values-in-matrix-or...))

4. **Assign Tooltip to Matrix**:
- Select your matrix visual.
- In the visual's settings, enable the tooltip and assign the newly created tooltip page. ([How to write comments for some or every values in matrix or any ...](https://community.powerbi.com/t5/Desktop/How-to-write-comments-for-some-or-every-values-in-matrix-or...))

Now, when users hover over a cell in the matrix, the corresponding comment will appear as a tooltip.

---

### 🔄 Dynamic Filtering

The setup described above supports dynamic filtering. When users apply filters (e.g., selecting specific `YP` values), the matrix will update accordingly, displaying only the relevant data.

---

Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!

View solution in original post

1 REPLY 1
johnbasha33
Super User
Super User

@ERing 

Thank you for sharing your Power BI file. Based on your objectives, here's how you can achieve the desired matrix layout:

---

### 1. Creating Row Groupings like “Jobs Ran” & “Tech Labor Hours”

To replicate the hierarchical row structure:

1. **Create a Disconnected Table**: Define a table (e.g., `MetricSelector`) with columns for `MetricGroup` and `MetricName`.

| MetricGroup | MetricName |
|--------------------|----------------|
| Jobs | Jobs Ran |
| Tech Labor Hours | Labor MTD |
| Tech Labor Hours | Labor PY |

2. **Load into Power BI**: Import this table without establishing relationships to other tables.

3. **Use in Matrix Rows**: In your matrix visual, set `MetricGroup` and `MetricName` as row fields to achieve the desired grouping.

---

### 2. Displaying MTD and Prior Year in Rows with Business Units as Columns

To structure your matrix with metrics in rows and business units in columns:

1. **Create a Measure**: Define a measure that switches values based on the selected `MetricName`.

```DAX
MetricValue =
SWITCH(
SELECTEDVALUE(MetricSelector[MetricName]),
"Jobs Ran", [JobsRanMTD],
"Labor MTD", [LaborHoursMTD],
"Labor PY", [LaborHoursPY]
)
```

Ensure that `[JobsRanMTD]`, `[LaborHoursMTD]`, and `[LaborHoursPY]` are existing measures in your model.

2. **Configure Matrix Columns**: Set `BusinessUnit` or the relevant dimension as the column field in your matrix.

3. **Set Values**: Use the `MetricValue` measure as the value field in the matrix.

---

### 3. Adding Comments to the Matrix

While Power BI's native matrix visual doesn't support direct input of comments per cell, you can implement comments using tooltips:

1. **Create a Comments Table**: Define a table with columns such as `MetricName`, `BusinessUnit`, and `Comment`.

| MetricName | BusinessUnit | Comment |
|--------------|--------------|--------------------------------|
| Jobs Ran | Unit A | High performance observed. |
| Labor MTD | Unit B | Slightly below target. |

2. **Establish Relationships**: If necessary, create relationships between the comments table and your existing tables based on `MetricName` and `BusinessUnit`.

3. **Create a Tooltip Page**:
- Add a new page to your report.
- Set the page size to Tooltip and enable the tooltip option in the page information.
- Design the tooltip to display the `Comment` field appropriately. ([How to write comments for some or every values in matrix or any ...](https://community.powerbi.com/t5/Desktop/How-to-write-comments-for-some-or-every-values-in-matrix-or...))

4. **Assign Tooltip to Matrix**:
- Select your matrix visual.
- In the visual's settings, enable the tooltip and assign the newly created tooltip page. ([How to write comments for some or every values in matrix or any ...](https://community.powerbi.com/t5/Desktop/How-to-write-comments-for-some-or-every-values-in-matrix-or...))

Now, when users hover over a cell in the matrix, the corresponding comment will appear as a tooltip.

---

### 🔄 Dynamic Filtering

The setup described above supports dynamic filtering. When users apply filters (e.g., selecting specific `YP` values), the matrix will update accordingly, displaying only the relevant data.

---

Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

Check out the April 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.