Divergent Stacked Bar Chart in Tableau : Bijay Kumar

Divergent Stacked Bar Chart in Tableau
by: Bijay Kumar
blow post content copied from  SalesForce FAQs
click here to view original post



### Summary of the Content The content discusses how to analyze profit and loss performance of products across different regions using Tableau, a data visualization tool. It focuses on creating a diverging stacked bar chart to visualize which product sub-categories are profitable and which are not, categorized by region. **Key Steps to Create a Divergent Stacked Bar Chart:** 1. **Data Selection:** Start with a data source like the Superstore dataset. 2. **Create the Chart:** - Drag the product sub-category to the Rows shelf and the sum of profit to the Columns shelf. - Adjust the X-axis to display both positive (profit) and negative (loss) values. - Use the Region dimension to color the bars for better visualization. 3. **Labeling:** Add sales figures to the chart and format them as currency. 4. **Sorting:** Optionally sort the bars by profit for clearer insights. **Use Cases:** - **Profit-Loss Analysis:** Visualize profit and loss for various products in specific regions. - **Sales Comparison:** Compare sales data between two regions by creating a calculated field to show divergence. ### Conclusion This tutorial provides a practical guide to creating diverging stacked bar charts in Tableau to effectively visualize financial performance and comparisons between different segments. ### Additional Context Diverging stacked bar charts are particularly useful for highlighting contrasts, making them valuable in business analytics for decision-making. By visually representing both profits and losses, organizations can quickly identify areas needing attention. ### Hashtags for SEO #Tableau #DataVisualization #DivergentStackedBarChart #BusinessAnalytics #ProfitLossAnalysis #SalesComparison #DataAnalysis #TableauTutorial #SuperstoreData #VisualizationTechniques


Using Tableau, we were analyzing the profit and loss performance of our product in different regions. To achieve this, we had to visualize the data to highlight which product sub-categories were generating profits and which were in losses, all within each region.

To visualize this data, we created a diverging stacked bar chart in Tableau. In this stacked bar, we used the region as a dimension. To show divergence in the chart, we will display positive (profit)bars on the right and negative (Loss) bars on the left, both stacked by sub-category of products.

In this blog, I will explain how to create a divergent bar chart in Tableau.

What is a Divergent Stacked Bar Chart in Tableau?

In Tableau, a divergent stacked bar chart is a horizontal bar chart format in which we can display data where categories have both positive and negative values or are split into a comparison view.

Use case of stacked bar chart in Tableau:

We can use the divergent stacked bar chart when we need to display the profit and loss for different products in specific regions. Here, the data will be stacked by the product category, showing profit and loss.

Another use case for the diverging stacked bar chart is when you need to compare data from two dimensions. The comparison can be the sales of two regions for the product categories.

Create a Divergent Stacked Bar Chart in Tableau

In the examples below, I will explain both the use cases:

  • Create a Divergent Stacked Bar Chart for Profit-Loss in Product Sales
  • Create a Divergent Stacked Bar Chart to Compare Sales of Two Regions

To create the divergent stacked bar chart, we need the data source. In the examples that follow, I will utilize the Superstore data from Tableau.

Divergent Stacked Bar Chart for Profit-Loss in Product Sales

After selecting the data source in Tableau, click on the Sheet tab in Tableau and follow the steps below.

  1. In the Tableau sheet, drag the Subcategory to the Rows shelf.
Divergent Stacked bar chart in Tableau
  1. We need to find the Profit for each region, for that we will add the Sum(Profit) to the Columns section.
Tableau divergent stacked bar chart

Now, you will see divergent bars on product sub-categories for the profit and less in sales.

  1. We need to modify the default range of positive and negative values on the X-axis. For this, right-click on the X-axis (profit) and select Edit Axis.
Create Divergent stacked bar chart in tableau
  1. On the axis, select the Range as custom and enter -5000 in the Fixed start and 150000 in the Fixed end.
Divergent Stacked bar chart in Tableau desktop
  1. Here, we will stack the bar graph with the profit and loss for the regions. Drag the Region dimension to the Color card in the Marks section.

Here, also set the Marks type from ‘Automatic‘ to ‘Bar‘.

Stacked bar chart with divergence in Tableau

After stacking the bar chart with Region, we can see the product sales profit and loss in each region, which can be identified by the color of the region.

How to create divergence in Tableau stacked bar chart

Check out: Stacked Bar Chart With Multiple Measures in Tableau

6. To show the exact amount of the profit and loss in the divergent stacked bar chart, drag the Sales(sum) to the Label card.

Create divergence in Tableau stacked bar chart
  1. Now, the Sales values will appear for profit and loss in each region, stacked in color. The values will appear in numbers, and to change them to a Currency format, click on the Sum label and select Format.
Create a Divergent stacked bar chart in Tableau
  1. In the format, select the Currency option. Now, the values of Profit and Loss will be displayed as currency.
Tableau Stacked bar chart divergence
  1. At last, select the view of the chart as Entire view to set the stacked bar chart in an appropriate proportion.
Tableau Stacked bar chart with divergence
  1. We can also sort the stack bars in ascending and descending order by Profit using the sort button on the X-axis.
Create Stacked Bar chart with divergent bars

This way, we can create a divergent stacked bar chart in Tableau to display the profit and loss in product sales.

Check out:  Create Pie Chart in Tableau

Create a Divergent Stacked Bar Chart to Compare Sales of Two Regions

In this example, we will display a stacked bar chart to display the sales comparison between two regions.

  1. In this example, we need the Sales to be distributed by category; for that, drag the Sales to the Column and the Sub-Category to the Rows.
Divergence stacked bar chart in Tableau
  1. Add the Region dimension to the color card. Here, we will only take two regions, East and West. To remove other regions, click on them and select Exclude.
Create Tableau divergent stacked bar chart
  1. Now, we will see the sales of two regions stacked for each region. To make this divergence, we need to add a calculated field.

Click on the Analysis tab and select Create a Calculated field.

  1. Enter the name for the Calculated field and enter the formula below, which will create divergence between the sales data of the East and West regions.
If [Region] = 'West' THEN -[Sales] ELSE [Sales] END
Calculated field in Divergent Tableau bar chart

This formula will filter the data of the West region and display it on the negative (left) side.

Check out: Add Charts to Reports in Salesforce

  1. Add the calculated field to the Columns and replace it with Sum. With this, we can see the divergence in the Sales data for the east and west regions.
Divergence in Tableau Stacked bar chart
  1. To stack this divergence chart, we will add the Segment dimension to the color card. This stacks the regional sales specific to the product segment.
Create Stacked bar chart with divergence in Tableau
  1. To add the sales number, drag the Sales measure to the Label card.
  2. To change the Sales values from Numbers to currency, click on “Sales” in the label card and select “Format”.

In the format, select the default numbers as currency.

Compare data using divergence stacked bar chart in Tableau
  1. Now, we can see the Sales values in the currency format. To set the chart in an appropriate proportion, select View as Entire View.
Tableau stacked divergent bar chart

In this divergent stacked bar chart, we are comparing the values of two sales regions. For this, we don’t need a value indicator on the x-axis. To remove this, click on it and uncheck Show header.

Tableau Divergent Bar Chart Stack values

We can also sort the bar chart by row value (sub-category) in increasing or decreasing order using the sort button.

Sorting in Tableau divergent stacked bar chart

This way, we can create a divergent stacked bar chart in Tableau to compare the Sales of two regions.

Conclusion

In this Tableau tutorial, we have learned how to create a divergent stacked bar chart to show both positive and negative values in the same chart. We discussed two examples, one to show the profit and loss of products in different regions, and another to compare sales between two areas.

You may also like to read:

The post Divergent Stacked Bar Chart in Tableau appeared first on SalesForce FAQs.


July 06, 2025 at 08:09AM
Click here for more details...

=============================
The original post is available in SalesForce FAQs by Bijay Kumar
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================

Salesforce