Clicky

Creating 100% Stacked Bar Charts with a Line in Power BI

how-to Feb 06, 2024
Creating 100% Stacked Bar Charts with a Line in Power BI
Profile Image
Hi, I'm Tom Blessing. I'm an expert at helping small to mid-sized companies adopt Power BI. I'm also a recovering investment banker, with deep experience applying technology to otherwise manual data problems. I have dual degrees in Finance and Technology Management from Indiana University.

Resources to help build your fundamentals: Learning Power BI? Data fundamentals are critical for this process to be easier. I've assembled a few DataCamp courses to help.

Introduction to Power BI course: Master Power BI basics and learn to build impactful reports.

Exploratory Data Analysis in Power BI course: Learn about Power BI's Exploratory Data Analysis (EDA) and enhance your reports.

Introduction to SQL course: Learn how to create and query relational databases using SQL in just two hours.

Introduction to DAX course: Learn the fundamentals of Data Analysis Expressions (DAX) such as calculated columns, tables, and measures.

Database Design course: Learn to design databases in SQL to process, store, and organize data in a more efficient way.

Also - need better equipment? For my loyal audience in India, check out Lenovo India.

I earn a small commission on these links if you click and purchase.


In Power BI, combining a 100% stacked bar chart with a line chart allows you to display the distribution of data within categories and compare it with a line that represents a specific metric or trend.

The bad news is that Power BI does not have a combo chart of 100% Stacked Bar + Line. 

The good news is that we can use a quick workaround of another chart type to get there, using a little DAX.

In this blog post, we'll explore how to create a 100% stacked bar chart with a line in Power BI to enhance your data insights and visualization capabilities.

The Power of Combined Visualizations

Using a 100% stacked bar chart alongside a line chart provides a comprehensive view of your data, enabling you to:

  1. Show Data Distribution: The stacked bar chart illustrates the distribution of data within categories, helping you understand the composition of each category.

  2. Highlight Trends: The line chart allows you to visualize a specific metric or trend that may not be directly related to the composition of the categories, providing valuable context.

Creating a 100% Stacked Bar Chart with a Line in Power BI

Follow these steps to create a 100% stacked bar chart with a line in Power BI:

Load Your Data:

Open your Power BI report or create a new one.

Load the dataset that contains the data you want to visualize.

Insert a Combo Stacked Bar Chart + Line

Create a new measure:

Right click on the table you want to use in your combo chart. Select New Measure. 

Define the measure as follows: 


100 Pct = VAR Val1AllCats = CALCULATE( SUM( 'Table'[value]), ALL( 'Table'[Category Field] ) )

RETURN

DIVIDE( SUM( 'Table'[value] ), Val1AllCats )


Format the new measure as a 'Percentage'.

Ok - what does this do? You're creating a DAX calculation, called "100 Pct", that divides each category by the sum of all categories, thereby tricking the Visualization to show a 100% stacked column.

Populate your Visualization wells:

Drop your new 100 Pct field into the Y-Axis well. Drag the field you want as the line into the Line Y-axis well. Then, place whichever category field you used to create the 100 Pct measure into the Column Legend.

BOOM! You now have a cool 100% Stacked Bar Chart with a Line, when Power BI doesn't even offer that kind of chart!

 

Benefits of Using a 100% Stacked Bar Chart with a Line

  1. Comprehensive Data Representation: Combining these two chart types allows you to provide a comprehensive representation of data, both in terms of composition and trends.

  2. Enhanced Insight: Viewers can quickly grasp the distribution of data within categories while simultaneously understanding a specific metric or trend.

  3. Contextual Analysis: The line chart provides context to the composition of categories, helping users interpret the significance of the data distribution.

  4. Effective Communication: When presenting insights or reports, this combined visualization method effectively communicates your data story.

Conclusion

Creating a 100% stacked bar chart with a line in Power BI is a valuable technique for enhancing data insights and providing a comprehensive view of your data.

By following the steps outlined in this guide and customizing your charts to suit your specific data and reporting needs, you can effectively convey data composition and trends in a single, compelling visualization.

This approach supports data-driven decision-making and strengthens the impact of your reports and dashboards.

Read more:
How To Append 3 Tables In Power BI. Read This If You're Lost.
How Slow Can You Go? How To Fix Power Query Slow Table Merge Problems
Troubleshooting Checklist: Power BI Desktop Not Updating
Difference Between Power BI and Automate: How To Know When To Use Each One
Simplistic Way to Think About Power BI Default Interactions

 

Download My Free Guidebook

The 3-Step Plan for Getting Started With PowerBI

Learn the best way I've helped large and small companies adopt the best analytics tool you've ever seen. In this FREE guide, I'll show you my complete startup strategy for Power BI.

We hate SPAM. We will never sell your information, for any reason.