top of page

A Bar Chart but with Shapes?

Updated: Jul 30, 2021

Have you ever wondered how to make a bar chart but with custom shapes? I documented the steps below from this youtube video by Toan Hoang.


With Tableau open, drag Orders to your data set pane. Then type the below in a blank Excel workbook.



Copy it and then paste it in the data source pane. Tableau will automatically pick it up from the clipboard.

You will need to join this clipboard data to your Orders table with a 1 to 1 relationship. You will do this manually by clicking on Create Join Calculation...


Enter 1 in the pop-up menu and click OK. Then select Create Join Calculation... under the second sheet you pasted in.


Enter a 1 in the pop-up menu and click OK.

Create a New Parameter on a sheet called "Density" with the following:

Data Type: Integer

Current Value: 3

Allowable Values: Range

Minimum: 3

Maximum: 12


Right-click on the Path measure and select Create > Bin.

Select your Density Parameter for the size of the bins drop-down.

Change your Mark Type to Circle.

Drag this Path bin to your Detail Marks card.


Create the following Calculated Fields;


Index

(Index()-1)/100


TC_Sales

Window_Sum(Sum([Sales]))/2


TC_Total Sales

Window_Sum(Sum([Sales]))/2


TC_Percentage of Total Sales

[TC_Sales]/[TC_Total Sales ]


Place Sub-category onto the Rows shelf.

Place Index on the Columns shelf.

Right-click on Index and select Compute Using > Path (bin)


Create the following Calculated Fields;


TC_Percentage of Total Sales (Adjusted)

[TC_Percentage of Total Sales]/WINDOW_MAX([TC_Percentage of Total Sales])


TC_Color

IIF([Index]/WINDOW_MAX([Index])<=[TC_Percentage of Total Sales (Adjusted)],"Color","Empty")


Place TC_Color on the Color Marks card.

Click on it and select Compute Using > Path (bin)

Right-click TC_Color and select Edit Table Calculation.


Select TC_Color from the Nested Calculations drop-down. Select Specific Dimensions and ensure both Path (Bin) and then Sub-Category are checked.


Then select TC_Percentage of Total Sales (Adjusted) from the Nested Calculations drop-down. Repeat the above steps.


Next select TC_Total Sales from the Nested Calculations drop-down and repeat the above steps.



If you are not seeing the below image, something is wrong. They must be done in this order.



Select a light gray for the Empty color.

You can change the Circle Mark Type to Shape.

Click on TC_Color and select the control key to duplicate this pill to put it on the Shape Marks card.


You can select a filled circle for the values and an empty circle for the gray values.


Right-click on your axis and uncheck Show Header.

Remove all of your grid lines etc.

You can also right-click on the field lines to hide them as well.


Place TC_Sales next to Sub-category on the Rows shelf. Make sure it is set to Discrete. Format this value as a currency without any decimal places, by right-clicking on the pill and selecting Format.


Put TC_Percentage of Sales on the Rows shelf next to TC_Sales. Make sure this pill is set to Discrete and right-click to Format it. Make it a percentage.


You can adjust the Font size and make it bold for each of these pills.


I display the Parameter and adjust the Density to reduce the amount of circles I have in the view.


If you replace TC_Color with Sub-Category on the Color Marks card, please note that you will have too many colors.



Commentaires


Subscribe to Tips

If you find my tips useful, please subscribe.

Thanks for submitting!

  • Twitter
  • Facebook
  • Linkedin

© 2023 by BrainStorm. Proudly created with Wix.com

bottom of page