Tuesday, March 5, 2013

[TABLEAU] Bar Charts In Tool Tips




Bar Charts in Tooltips

Displaying distribution or composition can be difficult on certain views such as maps or scatter plots, when the axis is dedicated to latitude and longitude or other measures. Using pie marks is an option, but often users have trouble discerning the size differences among slices in this mark type. This article covers a method to incorporate distribution or composition information as a bar chart within tooltips.


Cohort calculations

This method involves using one measure and one dimension.

Step 1
Create a calculated field that separates the measure so that it is specific to each member of the dimension. The calculated field should have a formula that fits using the following syntax:

IF [Dimension]="member 1" Then [Measure] END


 


Step 2
Repeat for each member in [Dimension]. You should have a separate cohort calculated field that describes the [Measure] for each member.






Creating calculated bar field

The purpose of using bars within a tool tip is to have a calculated string field 
that represents the appropriate length of each bar. Then, you can apply 
suggestions in the"Customize Tool tips" section of the Conditionally 
Formatting Tooltips article.

Step 1
Right-click anywhere in the Data window, and select Create Calculated Field.
This calculation represents the bar length for one of the dimension members.

Step 2
In the Formula text box, determine which of the following designs you wish
to use, and use one of the following formulas:
  1. If you want hashed bars, use:
LEFT("|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||",ROUND((SUM([Cohort Calc 1])
/SUM([Measure]))*100,0))






  1. If you want solid bars, use"█". This character is ASCII character 166, in the Arial Unicode MS font.
LEFT("████████████████████████████████████
█████████████████████████████",ROUND((SUM([Cohort Calc 1])/SUM([Measure]))*100,0))





The bar length in the tooltip is determined by the calculation:
ROUND((SUM([Cohort Calc 1])/SUM([Measure]))*100,0)
This formula determines the percentage of total of that member. The first part of the calculation (“||||" or "") is the characters that makes up the bar length. 

Because the percentage of total calculation is a rounding out of 100, place 100 "|" or "█" in the calculation to represent the accurate values.

Step 3
Repeat step 1-2 for each cohort calculation you wrote in the first section.

Step 4
Apply the new calculated string fields to the level of detail and follow the steps outlined in the"Customize Tooltips" section of the Conditionally Formatting Tooltips article for tips on how to format and arrange tooltip content.







1 comment:

  1. It is nice blog Thank you provide important information and I am searching for

    the same information
    Tableau Online Course

    ReplyDelete