How to Make a Stacked Bar Chart in Power BI

Cody Schneider

A stacked bar chart in Power BI is a fantastic way to compare totals across different categories while simultaneously showing the composition of each total. It answers two questions in one visual: "Which category is biggest?" and "What is each category made of?" This guide will walk you through creating, customizing, and mastering stacked bar charts in Power BI for clearer, more insightful reports.

What Exactly is a Stacked Bar Chart?

Imagine a standard bar chart that shows total sales for different regions: North, South, East, and West. Now, imagine that within each region's total sales bar, you could see the contribution from each product category - like electronics, apparel, and home goods. That's a stacked bar chart.

Each bar represents a total amount, and the segments within that bar represent the different parts that make up that total. It’s perfect for visualizing part-to-whole relationships across multiple categories.

When to Use a Stacked Bar Chart

Stacked bar charts shine in specific scenarios. They are most effective when your primary goal is to compare the total values for each category while providing some insight into the components of those totals.

  • You want to show a "part-to-whole" relationship: They are ideal for showing how different subgroups contribute to a total, such as revenue by product line for each sales quarter.

  • Comparing totals is the priority: If the most important message is comparing the total length of the bars (e.g., Q2 sales were higher than Q1), this chart type works well.

  • You have a limited number of segments: The chart is clearest when each bar is divided into a small number of segments (typically 2-5). Any more, and it can become cluttered and difficult to read.

When to Avoid It

While useful, they aren't a one-size-fits-all solution. You should consider another visual if:

  • Comparing segment sizes is your main goal: It is difficult to accurately compare the size of segments across different bars unless the segment is at the very bottom (on the baseline). For this, a clustered bar chart is a better choice.

  • You have too many segments: If each bar is broken down into ten different categories, the chart becomes a messy "rainbow" that's impossible to interpret. Stick to a few key contributors.

  • Your data includes negative values: Power BI can handle negative values in a stacked chart, but it can create a confusing visual that’s hard for your audience to understand.

Preparing Your Data

Before you jump into Power BI, make sure your data is structured correctly. For a stacked bar chart, Power BI needs data organized in a way that provides information for the axis, the values, and the stacks. A flat table format is ideal.

You need three key components in your dataset:

  • The Categorical Axis: This is the primary category that will define each bar. Examples include Country, Sales Rep, Marketing Channel, or Quarter.

  • The Numerical Value: This is the quantity that determines the size or length of each bar segment. This should be a numeric value like Sales, Revenue, or Pageviews.

  • The Legend Category: This is the dimension that will be used to segment or "stack" each bar. Examples include Product Category, Device Type, or Campaign Name.

Here’s a simple example of what your data structure should look like before you import it into Power BI:

Quarter, Product_Line, RevenueQ1, Laptops, 50000Q1, Phones, 75000Q1, Accessories, 20000Q2, Laptops, 65000Q2, Phones, 85000Q2, Accessories, 25000Q3, Laptops, 80000Q3, Phones, 95000Q3, Accessories, 30000

In this example, Quarter will be on our axis, Revenue will be our value, and Product_Line will be our legend (what creates the stacks).

Step-by-Step Guide: Creating a Stacked Bar Chart in Power BI

With your data ready, building the chart is a simple drag-and-drop process. Let's walk through it.

Step 1: Open Power BI and Load Your Data

First, launch Power BI Desktop. If you haven't already, load your data by going to the Home ribbon and selecting Get data. Choose your data source (e.g., Excel workbook, SQL server) and follow the prompts to load it into your report.

Step 2: Select the Stacked Bar Chart Visual

In the main report view, look at the Visualizations pane on the right-hand side. Find the icon for the Stacked bar chart and click it. An empty chart placeholder will appear on your report canvas.

Step 3: Add Your Data to the Fields

This is where the magic happens. With the visual selected, look at the Fields section within the Visualizations pane. You'll see several wells to drag your data into. For a basic stacked bar chart, you’ll focus on three:

  • Y-axis: Drag your main categorical data here. Using our example, you would drag the Quarter field to the Y-axis.

  • X-axis: Drag your numerical value here. This will be the Revenue field. At this point, you'll have a standard bar chart showing total revenue per quarter.

  • Legend: Drag the field you want to stack your bars with here. For our example, this is the Product_Line field.

As soon as you drop a field into the Legend well, your standard bar chart will instantly transform into a stacked bar chart, with colors assigned to each product line.

Customizing Your Chart for Impact

A default chart gets the job done, but a well-formatted chart tells a clearer story. You can customize nearly every element of your chart by selecting it and clicking the Format your visual icon (the paintbrush) in the Visualizations pane.

Formatting Axes and Legend

  • Y-axis & X-axis: Here you can turn off the axis titles to save space, change the font size and color of the labels (e.g., 'Q1', 'Q2'), or adjust the range of the x-axis.

  • Legend: Control the position (e.g., Top center, Right), turn the title on or off, and format the text. Placing the legend in an intuitive spot is crucial for readability.

Adding and Formatting Data Labels

Showing the value of each segment can make your chart much easier to understand at a glance.

  1. Under Format your visual, find the Data labels option and toggle it on.

  2. An arrow will appear next to the toggle. Click it to expand more formatting options for the labels, including their color, display units (thousands, millions), and decimal places.

  3. You can also turn on the Total labels option to display the total for the entire bar right at the end. This is a very helpful feature for stacked charts.

Adjusting Bar Colors

Default colors are fine, but you'll often want to align them with your company branding or use colors to convey meaning (e.g., green for positive categories, grey for neutral ones).

  1. Under the Format your visual tab, select Bars.

  2. You'll see a list of your legend categories (e.g., ‘Laptops’, ‘Phones’) with a color picker next to each one.

  3. Click the color to choose a new one from the theme palette or define a custom color.

Keep your color choices simple and distinct to avoid overwhelming your audience.

Pro Tip: Use the 100% Stacked Bar Chart for Proportions

Sitting right next to the stacked bar chart icon in Power BI is a similar but distinct visual: the 100% Stacked bar chart.

This chart type also shows segments within a bar, but it adjusts the axis so that every bar fills the full width to 100%. This is incredibly useful when you care more about the relative proportion of the segments rather than the absolute total. For example, you could use a 100% stacked bar chart to show the percentage of web traffic from mobile vs. desktop each month. It's not about total traffic, but about the mix or share.

To create one, simply select the 100% stacked bar chart icon and follow the exact same steps of dragging your fields to the axis, value, and legend wells.

Common Mistakes to Avoid

  1. Cluttering with Too Many Segments: Resist the urge to show every possible sub-category. If you have more than 5 segments, consider grouping the smallest ones into an "Other" category or choosing a different chart type.

  2. Inconsistent Sort Order: Make sure the bars on your Y-axis are sorted logically. You can sort by the category name alphabetically or, more usefully, by the total value of each bar. To do this, click the ellipsis (...) at the top right of the visual, go to Sort axis, and choose your desired sorting logic.

  3. Forgetting About Tooltips: You can add extra context that a user sees only when they hover over a segment. Drag another measure (like Profit Margin or Unit Count) into the Tooltips field well. This keeps the visual clean while providing deeper insights on demand.

Final Thoughts

Stacked bar charts in Power BI are a powerful visual for telling a layered data story by comparing totals and illustrating the components behind them. By properly preparing your data, using the fields correctly, and applying thoughtful formatting, you can turn a simple chart into a clear and compelling insight for your audience.

While mastering visuals in desktop tools like Power BI gives you deep control, the process is often manual, involving numerous clicks and a significant learning curve. We built Graphed to simplify all of that. You can connect your marketing and sales data sources in seconds, then create dashboards just by asking questions. For example, just type "Create a stacked bar chart showing revenue by product line for each quarter" and Graphed instantly builds the live, interactive chart for you, saving you valuable time and empowering your entire team to get answers from their data.