Sorting Stacked Bars by the Percentage of One Segment
28 Jan 2021
Last Modified Date:
08 Jul 2022
How to sort the stacked bar graph by the percentage of one segment just like below.
Create a calculation to get the percentage of the segment and sort the view by it.
1. Make a calculation like below to the percentage for 'Home Office'.
IF ATTR([Segment]) = "Home Office"
THEN SUM([Sales]) / TOTAL(SUM([Sales]))
2. Add this field to [Columns] Shelf along with the original measure
3. Edit table calculation Compute Using > Cell to show the right percentage
4. Sort the view by the percentage calculation.
Did this article resolve the issue?
Thank you for providing your feedback on the effectiveness of the article.
Click here to return to our Support page.
Open new Case
Open a new case
Click here to go to our Support page.
Get detailed answers and how-to step-by-step instructions for your issues and technical questions.
Find and share solutions with our active community through forums, user groups and ideas.
Browse a complete list of product manuals and guides. Available online, offline and PDF formats.
Training and Tutorials
Learn how to master Tableau’s products with our on-demand, live or class room training.
PRINT THIS PAGE
Sort with Percentage_v2018.3.twbx
Sort with Percentage.mp4
SUPPORT BY PRODUCT
TOOLS & DOWNLOADS
Download Tableau Desktop & Server
Tableau Online & Public Status
Send Large Files
All Tech Specs
Elite Account Management