> For the complete documentation index, see [llms.txt](https://docs.phocassoftware.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.phocassoftware.com/flex-modes/compare-data-in-a-matrix.md).

# Compare data in a matrix

A matrix displays selected entities from one dimension as columns and entities from another dimension as rows. For example, you might compare the performance of your top sales reps across the regions where you sell your products.

{% embed url="<https://phocassoftware.wistia.com/medias/lgphza565k>" %}
Compare data in a matrix
{% endembed %}

### View data in a matrix

Suppose you want to compare the performance of your top five sales reps across your product classes.

1. Select the first dimension you want to compare, such as **Sales Rep**.
2. Select the rows you want to display as columns, such as your top five performing sales reps.

   <div align="left"><figure><img src="/files/OBNkKbxUkbu3HckBBLSK" alt="" width="276"><figcaption></figcaption></figure></div>

   When you select rows, the **Matrix** button becomes available in the filter bar.
3. Select **Matrix**. The grid updates to display the selected entities as columns and filters out the other entities. The matrix filter displays as a tag in the filter bar and on the relevant dimension, so you can see which dimension and entities make up the matrix.

   <div align="left"><figure><img src="/files/5ZjErZPAkv2JlLsaBnDU" alt="" width="563"><figcaption></figcaption></figure></div>
4. Select the second dimension, such as **Product Class**. The entities in this dimension display as rows, allowing you to compare their values across the matrix columns.

   <div align="left"><figure><img src="/files/ZrYfHI27LCwObv88NkAH" alt="" width="563"><figcaption></figcaption></figure></div>

You can select another dimension at any time to change the rows in the matrix while keeping the matrix columns in place.

### Work with a matrix

After you view data in a matrix, you can continue to refine and analyze the results. For example, you can:

* [Focus on or exclude](/flex-modes/filter-data/focus-or-exclude-data.md) specific rows to narrow the results.
* [Apply additional filters](/flex-modes/filter-data/search-for-data.md#filter-from-the-grid) to refine the data.
* [Use advanced filters](/flex-modes/filter-data/create-advanced-filters.md) to create more complex conditions or combine multiple filters.
* [Change the properties, measures, or period](/flex-modes/customize-your-view.md) to analyze different data.

Your matrix and other filters display as tags in the filter bar and on the relevant dimensions, so you can see how the current view is filtered. Select a filter tag in the filter bar to open the advanced filter panel, where you can review or change the filter.

For more information about filtering, see [Filter data](/flex-modes/filter-data.md).

#### Apply conditional formatting

Apply conditional formatting to highlight values in the matrix that meet specific conditions.

Conditional formatting rules for a matrix are separate from those you apply to the standard grid. This allows you to highlight different values depending on how you are viewing the data.

For more information, see [Apply conditional formatting](/flex-modes/apply-conditional-formatting.md).

### Pivot a matrix

Pivot the matrix to switch which dimension displays as rows and which displays as columns.

1. Select the rows you want to display as columns.
2. Select **Pivot**.

The selected rows become the matrix columns, and the entities that were previously displayed as columns become rows.

<figure><img src="/files/0esogRjLWz9OqTQ5JP4p" alt=""><figcaption></figcaption></figure>

For example, if sales reps display as columns and regions as rows, you can select regions and pivot the matrix to display those regions as columns and the sales reps as rows.

### Save a matrix in a favorite

Save your analysis as a [favorite](/flex-modes/save-and-share-favorites.md) if you want to return to the same matrix later.

The favorite retains the matrix configuration, along with the other settings in your analysis. Any conditional formatting rules you've applied to the matrix are also retained.

When you open the favorite, the saved matrix view is applied.

### Remove the matrix

Select the **X** on the matrix filter tag to remove the matrix and return to the standard grid view.

To remove the matrix and reset the other changes you've made to the analysis, select [**Reset**](/flex-modes/reset-data.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.phocassoftware.com/flex-modes/compare-data-in-a-matrix.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
