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>
<Desired Behavior>
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. 6. Drag [Columns Size] to Columns and [Rows Size] to Rows. 7. Drag [Ship Date] to Columns. 8. Drag [Sub-Category] to Color on Marks. 9. Drag [Sales] to Rows. 10. Right-click on [Columns Size] placed on Columns then select Edit Table Calculation and set as follows 11. Right-click on [Rows Size] placed on Rows then select Edit Table Calculation and set as follows 12. Toolbar -> Analysis -> Table Layout -> Show Empty Columns 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. 18. Right-click on [Label: Horizonal Position] placed on Rows then select Edit Table Calculation and set as follows 19. Open Mark card of [Label: Horizonal Position] then drag [Sub-Category] placed on Color to Labels 20. Change chart type to Text 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.