KNOWLEDGE BASE

How to create Panel Chart showing Bar Chart and displaying labels for each panels


Published: 21 Jun 2023
Last Modified Date: 26 Jun 2023

Question

How to create Panel Chart showing Bar Chart

<Current Behavior>
User-added image

<Desired Behavior>
User-added image

Environment

  • Tableau Desktop

Answer

Please follow along with the attached sample workbook to the right of this text in the Attachments section.

<STEP 1>
Connect to the sample data and create two calculated fields.

1. Connect to the Sample Superstore data from Tableau Desktop.
2. Create a new calculated field as follows:
     Name : Columns Size
     Calculation : int( (index()-1)/(round(sqrt(size()))))
3. Create a new calculated field as follows:
     Name : Rows Size
     Calculation : (index()-1)%(round(sqrt(size())))
4. Right click on Rows Size and Columns Size -> Convert to Discrete

<STEP 2>
Create a panel chart.

5. On the Marks card, change the mark type to Bar.
User-added image
6. Drag [Columns Size] to Columns and [Rows Size] to Rows.
User-added image
7. Drag [Ship Date] to Columns.
User-added image
8. Drag [Sub-Category] to Color on Marks.
User-added image
9. Drag [Sales] to Rows.
User-added image
10. Right-click on [Columns Size]  placed on Columns then select Edit Table Calculation and set as follows
User-added image
11. Right-click on [Rows Size] placed on Rows then select Edit Table Calculation and set as follows
User-added image
12. Toolbar -> Analysis -> Table Layout -> Show Empty Columns
User-added image
13. Drag [Sub-Category] to Filters -> OK
14. Right click on [Sub-Category] on Filters -> Show Filter
15. Right click on [Columns Size]  placed on Columns then select Show Header.
16. Right click on [Rows Size]  placed on Rows then select Show Header.

<STEP 3>
Displaying Labels for Each Panels.

15. Create a new calculated field as follows
       Name :Label: Vertical Position
       Calculation : WINDOW_MAX(SUM([Sales]))
16. Create a new calculated field as follows
       Name :Label: Horizonal Position
       Calculation : IF INDEX() = ROUND(WINDOW_MAX(INDEX())/2) THEN [Label: Vertical Position] END
17. Drag [Label: Horizonal Position] to Rows.
User-added image
18. Right-click on [Label: Horizonal Position] placed on Rows then select Edit Table Calculation and set as follows
User-added image
19. Open Mark card of [Label: Horizonal Position] then drag [Sub-Category] placed on Color to Labels
User-added image
20. Change chart type to Text
User-added image
21. Right-click on [Label: Horizonal Position] placed on Rows then select Dual Axis.
22. Right-click on [Label: Horizonal Position] placed on Rows then select Show Header.
Did this article resolve the issue?