How to Make a Stacked Bar Chart in Looker with AI
A stacked bar chart is one of the most effective ways to show how a total is divided into different parts across several categories. If you want to see not just your total sales per region, but also which product categories contributed to those sales, a stacked bar chart is your go-to visualization. This guide will walk you through exactly how to create, customize, and interpret a stacked bar chart using Looker.
What is a Stacked Bar Chart and Why Use It?
Unlike a standard bar chart that only compares totals, a stacked bar chart goes one level deeper. Each bar represents a total value, but it's segmented into sub-categories, with each segment's length representing its share of the total. Think of it as a series of pie charts laid out on a bar graph.
This visualization is incredibly useful for answering questions like:
- What is our total revenue per country, and which product lines are the most popular in each market?
- How many website sessions did we get each month, and what were the primary traffic sources (Organic, Paid, Direct)?
- What is the deal size breakdown for each sales representative, segmented by deal stage (Discovery, Proposal, Negotiation)?
The goal is to compare the overall totals across the main category (the bars) while also understanding the composition of each total (the stacks).
When to Avoid a Stacked Bar Chart
While powerful, stacked bar charts have limitations. They're not ideal when you need to precisely compare the performance of a sub-category across different bars. Because the segments (except for the bottom one) don't share a common baseline, it's difficult to see minor differences. For example, it would be hard to accurately compare revenue from your "Accessories" category in France versus Germany if "Accessories" is the third stack up from the bottom.
Also, try to limit the number of segments. A bar with ten different colored stacks becomes a "rainbow chart" that's cluttered and impossible to interpret. A good rule of thumb is to keep it under five segments per bar.
Preparing Your Data for Looker
Before you even click the "visuals" button, success in Looker begins with how your data is structured. All charts are built from an "Explore," which is a user-friendly starting point for a query created by a data developer using LookML.
To build a stacked bar chart, you need three key ingredients from your Explore:
- A Dimension for the Bars: This will be your X-axis. It’s the primary category you're comparing. Examples:
Order Date - Month,User - Country,Sales Rep - Name. - A Measure for the Bar Height: This is the numerical value that determines the total height of each bar, representing your Y-axis. Examples:
Orders - Total Revenue,Website - Sessions,Deals - Count. - A Pivot Dimension for the Stacks: This is the secret sauce. It’s the dimension that will slice each bar into segments. The unique values in this field will become the "stacks." Examples:
Product - Category,Traffic - Source,Deal - Stage.
Ensuring your Looker developer has modeled this data correctly within an Explore is the most important step. Without a pivotable dimension, you won't be able to create the stacks.
Step-by-Step Guide: Building Your Stacked Bar Chart in Looker
With your data ready to go in an Explore, let's walk through the creation process from start to finish.
Step 1: Navigate to Your Explore
From the Looker home screen, use the "Explore" menu to find the data set you need. For a sales report, you might go to an Explore named "Orders" or "Sales Performance." Think of this as choosing your raw ingredients before you start cooking.
Step 2: Select Your Fields and Pivot
In the field picker on the left, you’ll find your available Dimensions and Measures.
- Select Main Dimension: Click on the dimension you want for your bars (e.g.,
Order - Created Month). This will serve as your x-axis. - Select Pivot Dimension: Find the dimension you want to use for the stacks and, instead of just clicking it, click the Pivot icon next to its name (e.g.,
Product - Category). This tells Looker to create a separate column for each unique product category. - Select Measure: Click on the measure that will determine the bar's height (e.g.,
Orders - Total Sale Price).
Step 3: Run the Query
Click the orange "Run" button in the top right. Below the visualization pane, you'll see a data table. Thanks to the pivot, you’ll now have your Created Month in the first column, and then individual columns for each Product Category, with Total Sale Price populating the cells. This format is exactly what Looker needs to build the stacked chart.
Step 4: Choose the Correct Visualization
Above the data table, click the "Visualization" tab. Looker is pretty smart and might have already suggested a column (bar) chart. If not, click on the three dots (...) to browse visualization types and select the bar chart icon.
By default, Looker often displays pivoted data as a grouped bar chart, with separate bars for each category clustered together. The next step is to stack them.
Step 5: Configure the Stacking Option
This is where the magic happens. To the right of the visualization, click the "Edit" button to open the settings panel.
- Navigate to the Plot tab.
- Find the "Stacking" option, which is likely set to "Grouped."
- Change this to Normal.
Instantly, your grouped bars will reassemble themselves one on top of the other, forming perfect stacked bars. You can also select "Percent" here if you wanted to create a 100% stacked bar chart, which is useful for comparing proportional composition when the totals are wildly different.
Customizing Your Chart for Analytics-Ready Reports
A functional chart is good, but a clear, easy-to-read chart is great. Looker's customization options can help you transform your raw visual into a polished reporting asset.
Improving Your Color Palette and Legend
Default colors aren't always ideal. In the "Series" tab of the visualization editor, you can assign specific colors to each segment. Use brand colors for consistency or choose a contrasting palette that makes each stack distinct. You can also choose from Looker’s built-in qualitative or sequential color palettes. Here, you can also change the label for each series to be more descriptive (e.g., change "clothing" to "Apparel & E-Wear").
Better Labels and Axis Formatting
Clarity is everything. Under the "X" and "Y" tabs, you can give your axes clear names like "Month of Sale" and "Total Revenue (USD)." In the "Values" tab, you can toggle "Value Labels" to show the exact number for each segment directly on the chart, though this can get cluttered on smaller bars. A good alternative is using "Tally Label for Totals" which displays the total for the entire bar right at the top.
Take Advantage of Interactivity
Don't forget that Looker charts aren't static images. You can hover over any segment to see a detailed tooltip showing the dimension, pivot dimension, and measure. More importantly, you can click on any segment to "Drill Down" and see the underlying row-level data that makes up that specific number. This allows you to go from a high-level trend directly to the individual records driving that trend, a crucial feature for any real analysis.
The BI Tool Challenge: Moving Past Manual Chart Building
As you can see, building just one stacked bar chart in Looker requires an understanding of its specific workflow: knowing what an Explore is, how to select fields, what a pivot does, and where to find the stacking setting. While data analysts live in this world daily, it's a significant learning curve for marketers, sales leaders, or founders. What happens when you have a follow-up question? Or if you want to see the data stacked by Traffic Source instead of Product Category? You have to go back into the editor and repeat the process.
This is where traditional business intelligence tools often become a bottleneck. The time spent navigating complex interfaces is time not spent on insights and taking action. Relying on a data team for every small change creates delays that prevent agile decision-making. Marketers shouldn't need a mini-course on pivoting and series formatting just to figure out which ad campaigns are driving sales for which products.
Final Thoughts
Creating a stacked bar chart in Looker is a methodical process of choosing the right fields, setting up a pivot, and configuring visualization settings. It grants analysts granular control to build powerful, detailed reports that show part-to-whole data. Once you master the workflow, it’s an effective tool for seeing both the big picture and the components that shape it.
However, we believe getting vital business answers shouldn't require technical expertise or navigating a complex interface. We built Graphed because creating charts should be as simple as asking a question. Instead of clicking through menus to select dimensions, pivots, and stacking options, you simply ask, "show me revenue by month stacked by product category," and Graphed builds the interactive, real-time visualization for you. This frees your team from being BI tool experts and empowers them to be curious, ask follow-up questions, and explore data without friction.
Related Articles
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.
How to Create a Photo Album in Meta Business Suite
How to create a photo album in Meta Business Suite — step-by-step guide to organizing Facebook and Instagram photos into albums for your business page.