• Dynamic Annotations (Part 2)

    Edit – This post describes one approach. But, it turns out, there is an easier way: Dynamic Annotations (Part 3)

    Part 1 described how to implement dynamic annotations in Tableau using a copy of a measure as a dual axis.  However, there were some limitations to that approach.  The biggest limitation is that you won’t be able to use the dual axis for anything else.

    Here is a dashboard with a dual axis combo chart view that makes use of dynamic annotations.

     

    This solution is very similar to the one proposed in Part 1.  However, instead of using a dual axis, I’m using the Measure Names / Measure Values.  With this approach, I can have as many copies of the measure for the marks I want to annotate as I want.  In that way, I can have multiple “sets” of annotations.

    Here are the steps:

      1. Create a parameter to control which set of annotations is shown.
        image
        Tip: Use an integer type for performance and ease of coding.  You can change the “Display As” value for user-friendliness.
      2. For every field that will define a mark for which you will use dynamic annotations, create a calculated copy.  Create a copy for each “set” of annotations. Here is an example of the calculated copies of the Sales measure.  Note that the field only has a value when the corresponding parameter is selected.  Otherwise it evaluates to NULL.
    Field Name Calculation
    Sales (Annotation Set 1) IF [Annotation] = 1 THEN [Sales] END
    Sales (Annotation Set 2) IF [Annotation] = 2 THEN [Sales] END
    Sales (Annotation Set 3) IF [Annotation] = 3 THEN [Sales] END
    Sales (Annotation Set 4) IF [Annotation] = 4 THEN [Sales] END
    1. Once you have a view using the original field to define the marks as you want, replace that field with the [Measure Values] field.  Then make sure each calculated copy is placed on the Measure Values shelf.Add Copies to Measure Values Shelf
      Tip: You will need to add [Measure Names] to the Level of Detail if you want to connect a line.
    2. Cycle through selecting each parameter value.  Add mark annotations as desired for each parameter selection.

     

    That’s it!  You now have annotations that dynamically change based on end-user interaction!

5 Responsesso far.

  1. Aimee Parker says:

    This is incredible and exactly what I’ve been trying to do!!! Is there any way you could post the file or send me the file for reference? I’m relatively new to Tableau and find that “tracking down” your steps helps me understand I’m putting things in the correct place 🙂

    Thanks!!

  2. Vishwanath says:

    Hi Joshua

    I am looking for dynamics annotations, But here user is interested to add the notes and findings on the server side .. more like comments but on the server side and on the chart.

    I know this is not readily available . But we could using some external api and html pages and drag it as a webpage object. I want to know if you have come across this kind of use case and have any better way of approaching it

    Thanks
    Vishwanath

    • Vishwanath,
      I think it would be possible. You could also use parameters to allow the user to type in notes that would then be displayed in a view using a calculated field. They would not be permanent, though.

Leave a Reply

Your email address will not be published. Required fields are marked *