Bar Charts in Tooltips

Displaying distribution or composition can be difficult on certain visualizations such as maps or scatter plots where the axis is dedicated to latitude and longitude or other measures. Using pie marks is an option, but often users have trouble discerning the difference of certain slices using this mark type. The following article covers a method to incorporate distribution or composition information as a bar representation within tool tips.

Cohort calculations

Step 1

This method involves using one [Measure] and one [Dimension]. Start by creating a calculated field that separates the [Measure] so that it specific to each member of the [Dimension]. The calculated field should have a formula that fits in the following syntax:

IF [Dimension]=”member 1” Then [Measure] END
Creating a cohort calculation for sales specific to "Coffee" category

Step 2

Repeat for each member in [Dimension]. You should have a separate cohort calculated field that describes the [Measure] for each member.
Replicate calculation for each category in product type

Creating calculated bar field

The concept behind having bars within tooltips is to have a calculated string field that represents the appropriate length of each bar. Once that is the case, we can apply the field much like how we did in the “Customize Tooltips.” section in the Conditionally Formatting Tooltips article .

Step 1

Create a calculated field; this will represent the bar length for one of the members.

Step 2

Within the formula of the calculated field, determine which of the following designs you wish to use and follow the formula format of each:

  1. If we are looking to have hashed bars, use:

    LEFT("|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||",ROUND((SUM([Cohort Calc 1])/SUM([Measure]))*100),0)

    Formula for hashed bars

    Hashed bars result

  2. If we are looking to have solid bars, use (“█” character is ASCII character 166, it requires you use Arial Unicode MS font)

    LEFT("█████████████████████████████████████████████████████████████████",ROUND((SUM([Cohort Calc 1])/SUM([Measure]))*100),0)

    Formula for solid bars

    Solid bars result

Realize that the true determination of bar length is the calculation:

ROUND((SUM([Cohort Calc 1])/SUM([Measure]))*100,0)

This determines the % of total of that member. The first part of the calculation (“||||” or "██”) is the characters that make up the bar length. Because the % of total calculation is a rounding out of 100, it is advised to have 100 "|" or "█" in the calculation to represent the accurate values.

Step 3

Repeat step 1-2 for each cohort calculation your wrote in the first section

Step 4

Apply the new calculated string fields to the level of detail and follow the steps outlined in “Customize Tooltips.” section of the Conditionally Formatting Tooltips article for tips on how to format and arrange these new fields in the

Formatted hash bars

Formatted solid bars