Hello! Welcome back to our course on creating financial data visualizations.
In our last lesson, we focused on displaying single, high-level metrics using Card and Gauge visuals. You learned how to highlight key performance indicators (KPIs) like a stock's current price or progress toward a financial goal, providing an immediate snapshot of performance.
Today, we shift from looking at single numbers to understanding how different components contribute to a whole. This is crucial for answering questions like, "Which sectors are driving the market?" or "What are the largest companies within an index?" Our learning outcome is to design matrix and treemap visuals for sector performance and market capitalization comparisons. These visuals are staples in financial analysis for breaking down and comparing parts of a larger group.
By the end of this lesson, you will be able to build clear, hierarchical views of your financial data, enabling powerful comparative analysis.
1. The Matrix Visual: A Supercharged Table
Think of the Matrix visual as a powerful version of a table, similar to a PivotTable in Excel. It's designed to display data in a grid of rows and columns, but its key feature is the ability to create a hierarchy that users can drill into for more detail. This makes it perfect for analyzing financial data at different levels, like looking at a sector's total market cap and then expanding it to see the individual companies within that sector.
Let's begin by understanding the fundamentals of the Matrix visual.
Introduction to Power BI Visuals: A Beginner's Guide
This article from DataCamp, 'Introduction to Power BI Visuals,' provides a concise explanation of hierarchical visuals. We'll focus on the Matrix section.
Please read the section titled 'Hierarchical and Comparative Visuals,' focusing specifically on subheading '6. Matrix visual.' The example uses a mock finance dataset, but the principles of dragging fields into Rows, Columns, and Values are universal.
As the article demonstrates, the power of the matrix comes from populating the Rows, Columns, and Values wells in the Visualizations pane. You can create a hierarchy by dragging multiple fields into the Rows well. For example, you could drag 'Sector' and then 'Stock Symbol' underneath it.

In financial analysis, you might use a matrix to:
- List market sectors in the rows and see their total market cap in the values.
- Add 'Industry' under 'Sector' in the rows to create a drill-down hierarchy.
- Place different years in the columns to compare year-over-year performance for each sector.
2. The Treemap Visual: Seeing the Big Picture
While a matrix is great for detailed, tabular analysis, a Treemap is designed for at-a-glance, proportional comparison. It visualizes hierarchical data as a set of nested rectangles. The size of each rectangle represents a specific value (like market cap), and they are grouped by category (like sector). This makes it incredibly easy to spot the biggest contributors instantly.
Let's watch a video to see how to build and customize a treemap in Power BI.
PRACTICAL WAYS to use TREEMAP in Power BI // Beginners Guide to Power BI in 2023
This video from Fernan | Power BI provides a clear, practical guide to using treemaps. Although it uses a sales dataset, the process for creating and formatting the visual is identical for financial data.
Please watch from the beginning until 04:39. Pay attention to three key concepts: Proportional Representation (00:29 - 02:18): Notice how the size of each rectangle is determined by its value, making it easy to see the largest categories. Formatting (02:18 - 03:54): Observe how you can customize colors and add data labels to show the actual values, which is important for clarity. Adding Detail (03:54 - 04:39): See how adding a second field to the 'Details' well breaks down the larger rectangles into smaller ones. This is how you would show individual stocks within a sector.
Applying Treemaps to Financial Markets
Now, let's apply this to a classic financial markets scenario: visualizing the S&P 500. A treemap is the perfect visual to show the composition of the index, with sectors as the main categories and individual companies sized by their market capitalization.
The image below is a great example of what we can achieve. It shows the top 200 companies in the S&P 500, grouped by sector. Notice how you can immediately see that 'Technology' is the largest sector and that 'AAPL' (Apple) and 'MSFT' (Microsoft) are the dominant companies within it.

This kind of visualization is built by:
- Dragging the
Sectorfield into theCategorywell. - Dragging the
Market Capitalizationfield into theValueswell. - Dragging the
Stock Symbolfield into theDetailswell.
This structure tells Power BI to create large rectangles for each sector, size them based on the total market cap of all companies within them, and then divide each sector rectangle into smaller rectangles representing each company.
3. Matrix vs. Treemap: When to Use Which?
Both visuals are used for comparison, but they serve different purposes. Choosing the right one depends on the question you want to answer.
-
Use a Matrix when:
- You need to see precise numerical values.
- You want a structured, tabular layout that is easy to read and export.
- You need to compare multiple metrics for each item (e.g., showing columns for Market Cap, P/E Ratio, and Dividend Yield for each stock).
- The audience needs to perform detailed analysis and look up specific numbers.
-
Use a Treemap when:
- You want to quickly understand the part-to-whole relationship and identify the largest components.
- The primary goal is a high-level visual comparison, not numerical precision.
- You are presenting to an audience and want to draw their attention to the biggest contributors at a glance.
- You have a large number of categories that would be difficult to compare in a bar chart.
Test your understanding!
You are building a dashboard to analyze the Nifty 50 index. You have data for each company, including its Sector, Market Cap, and P/E Ratio.
- To create a visual that quickly shows the market-cap weight of each sector in the index, which visual would you choose?
- An analyst asks for a report where they can see all 50 companies grouped by sector, with the ability to sort the companies by either their Market Cap or P/E Ratio. Which visual would be more appropriate for this request?
Show answer
- A Treemap would be the best choice. Its primary strength is visualizing part-to-whole relationships, making it perfect for showing the proportional market-cap weight of each sector.
- A Matrix is the correct choice here. It allows you to present the data in a structured table, group rows by 'Sector', and include columns for both 'Market Cap' and 'P/E Ratio', which the analyst can then sort as needed.
Conclusion
Great work today! You have added two essential comparative visuals to your Power BI toolkit. You can now move beyond single KPIs and start breaking down your data to reveal its underlying structure.
Key Takeaways:
- Matrix Visuals are for structured, hierarchical analysis. They function like pivot tables and are ideal when you need to see precise numbers in a detailed, drill-down format.
- Treemap Visuals excel at showing part-to-whole relationships. They use size and color to provide an immediate, high-level understanding of the composition of a market or portfolio.
- Choosing between a Matrix and a Treemap depends on whether your goal is detailed numerical analysis (Matrix) or high-level proportional comparison (Treemap).
In our next lesson, we will make these visuals even more powerful. You'll learn how to implement slicers and filters to enable dynamic user-driven exploration of financial data. This will allow you and your audience to interact with your reports, filtering the entire dashboard to focus on specific sectors, companies, or time periods with just a click.
Can't find a good explanation? Sign up and we'll make it for you
Sign up