Stacked Bar Chart in SSRS

In this article, we will show you how to create a Stacked Bar Chart in SSRS, How to change the Chart Title, Legend Position, Legend Title, Stacked Bar Chart Font style, Chart Model, and Display Data Labels on Stacked Bar Chart in SSRS or SQL Reporting Services with an example.

For this SSRS stacked bar chart example, we are going to write the Custom Query against the SQL Server Data Source. The query that we are going to use for this report. Please type the above query inside the SQL Management Studio to see the Data that it’s going to return.

-- SQL Query that we use in SSRS Stacked Bar Chart
SELECT Cat.[EnglishProductCategoryName] AS ProductCategory,
SubCat.[EnglishProductSubcategoryName] AS ProductSubCategory,
Prod.EnglishProductName AS ProductName, Prod.Color,
Fact.OrderQuantity, Fact.TotalProductCost, Fact.SalesAmount, Fact.TaxAmt,
Fact.[Freight] FROM FactInternetSales AS Fact
INNER JOIN DimProduct AS Prod ON Fact.ProductKey = Prod.ProductKey
INNER JOIN DimProductSubcategory AS SubCat ON Prod.ProductSubcategoryKey = SubCat.ProductSubcategoryKey
INNER JOIN DimProductCategory AS Cat ON SubCat.ProductCategoryKey = Cat.ProductCategoryKey

In this example, we are going to create a Stacked Bar Chart to display the Order Quantity grouped by product Color, and grouped by the Product Category. The above code shows the Data Source (Adventure Works DW) and Dataset (query) we used for this Stacked Bar Chart Report.

Create a Stacked Bar Chart in SSRS

In the report design, we can add a Stacked Bar Chart by dragging the Chart property from the SSRS Toolbox to the Design space. Or, we can right-click on the report designer to open the context menu. From the context menu, please select the Insert -> Chart option.

Choose Insert Chart Option

Once you select the Chart option, a new window called Select Chart Type will be opened to select the required chart from the available ones. For this SSRS example, we are selecting a Stacked Bar Chart.

Choose the SSRS Stacked Bar Graph

Once you click on the OK button, the Stacked Bar Chart will display in the design region with dummy data. Click on the empty space around the Stacked Bar Chart will open the Chart Data window

  • Values: Any Numerical (Metric) value such as Total Sales, Sale Amount, Number of Customers, Tax, etc. All these values will be aggregated using an aggregate function (Sum, Avg, Count, etc). It is because we are grouping them with the category group items.
  • Category Group: Please specify the Column name on which you want to partition your Stacked Bar Chart.
  • Series Group: Please specify the Dimension here. It will further group the individual category

As we said before, In this example, we create an SSRS Stacked Bar Chart to find the number of orders by color grouped by the product category.

So, Drag and drop the Order Quantity column from dataset to chart data values, Product Color to category group, and Product Category to Series Group.

Add Category and Series Group columns

Click on the Preview tab to see the report preview.

Stacked Bar Chart in SSRS Preview

If you observe the above screenshot, we are unable to identify the exact Order Quantity. So, let us add the Data Labels.

Format Stacked Bar Chart in SSRS

The following list of examples will show you the steps involved in formatting the Stacked Bar Chart in SSRS

Add Data Labels to Stacked Bar Chart in SSRS

Right-click on the Stacked Bar Chart, and select the Show Data Labels option from the context menu to show the values

Show Data Labels for Stacked Bar Chart

Next, let me format the Font of Data Labels. To do so, Please select the Data labels, and right click on it will open the context menu. Next, please select the Series Label Properties option from it.

Stacked Bar Chart Series Label Properties

Here we are changing the font to Century Gothic, the font size to 10pt

Change Stacked Bar Chart Series Font

Change Axis properties of a Stacked Bar Chart in SSRS

Right-click on the Axis of a Stacked Bar Chart, and select the Horizontal Axis Properties.. option from the context menu to format the Axis values.

Stacked Bar Chart Horizontal Axis Properties

Here we changed the Font style and font size of the Horizontal Axis. Please use the same technique to change the font of the vertical Axis

Stacked Bar Chart 12

Change Axis Titles of a Stacked Bar Chart in SSRS

To change an Axis title, select the Axis title region, and change the title as per your requirement. Or, right-click on it will open the context menu. Please select the Axis Title properties.. option from it.

Stacked Bar Chart Axis Title

This will open a new window called the Axis Title Properties window. Under the General section, we can change the Title text as per our requirements. For now, we are changing it to PRODUCT COLOR GROUP

Under the Font tab, we can change the font style, size, and color. For now, we are changing the Color to Dark Green, the Font to Comic Sans MS, the Size to 12pt, and the style to Bold.

Stacked Bar Chart Axis Title properties

Please apply the same properties to Y-Axis, as well. Once you complete, click on the Preview tab to see the report preview.

Stacked Bar Chart 16

Change SSRS Stacked Bar Chart Title

To change a Stacked Bar Chart title, Please select the Chart title region, and change the title as per your requirement. OR, right-click on it will open the context menu. Please select the Title properties.. option from it.

Stacked Bar Chart Title Properties

Here we are changing the title as SSRS Stacked Bar Chart Example because the report is displaying the same

Stacked Bar Chart Title position

Format SSRS Stacked Bar Chart Title Font

Within the Font tab, we can change the Font Size, Font Family, Font Style, and Color of a Stacked Bar Chart Title. Here, we are changing the font to Comic Sans MS, Font size to 14pt, and colour to Brown

Stacked Bar Chart 19

Format Legend of a Stacked Bar Chart in SSRS

To format the Legend region, Please Select the Legend region, and right-click on it will open the context menu. From the menu, please select the Legend Properties option.

Stacked Bar Chart Legend properties

It opens a new window called the Legend Properties Window. Within the General Tab, we have an option called Legend Position to change the Legend Position by changing the dot positions. For now, we are changing the position from the default right corner to the Middle.

Under the Font tab, we can change the Font style, size, and color of a Legend. For now, we are changing the Color to Purple, Font to Century Gothic, Size to 10pt, and style to Bold

Stacked Bar Chart Legend position

Click OK button to close the Properties window, and hit the preview tab to see the report preview

Stacked Bar Chart 23

Different Stacked Bar Charts in SSRS

SSRS allows us to change the chart type even after creating a Stacked Bar Chart. To do so First, select the Stacked Bar Chart, and right-click on it will open the context menu. Please select the Change Chart Type… option

Stacked Bar Chart 24

Once you select the Change Chart Type… option, it will open a new window called Select Chart Type to select the change. Here we are selecting the 3D Stacked Column Chart

3D Stacked Column Chart

Click on the preview tab to see the report preview

3D Stacked Bar Chart

From the above screenshot, you can observe that We successfully changed the Chart Type from 2D Stacked Bar Chart to 3D Stacked Bar Chart

This time we are going to change the SSRS Chart Type from 3D Stacked Bar Chart to 100% Stacked Column Chart

100% Stacked Column Chart

Click on the preview tab to see the report preview. As you can see, it is showing the percentage by series group

100% Stacked Bar Chart

This time we are going to change the Chart Type to 3-D 100% Stacked Column chart

3d 100% Stacked Column Chart

Click on the preview tab to see the SSRS Stacked Bar Chart preview

3d 100% Stacked Bar Chart