Commenting On Data Points In Dashboard

Version 2

    One of the functionalities I am seeing Tableau users request increasingly more often is the ability to use commentary on dashboards in Tableau - especially when they distribute this content. Specifically, users want the ability to tie comments to data, and make this part of the visualization (interactive if possible). The current ability to use the comments section on Tableau Server is nice, and we obviously have options such as labels and annotations within dashboards that can enable us in this effort. However this approach has several limitations:

    1. You can only show existing data - that is you must have the comments data in the data, or in a different dataset that you blend with your existing data, OR
    2. It requires you to manually add a comment for every data point you want commentary for, and this all has to be done before the dashboard is published.
    3. You, and more importantly your users, who may have even deeper insight to the data, cannot add data on the fly or any time after it has been published without updating data through #1 or #2.

    My past recommendation has been that this be used in conjunction with an embedded web-part which you use to enter and display comments. The problem with this boils down to many departments and companies simply do not have such a system in place, the infrastructure to support it, nor the manpower (or perhaps the coding acumen) to accomplish this. Alternatively, I have said that such a use case may not be the best fit for Tableau. That is, until I had a customer ask me this question just after I showed them how to create custom admin views against their Tableau Server Postgres database, which gave me an idea… Why not create a connection to the Comments table and use this with your visualization?! This would enable real-time commenting into your data, so that your users could provide further commentary or additional insight into a specific data point. This needs to go beyond a juxtaposition of data and comments - you need to tie the comments to the data. That sounds like a perfect use-case for blending, but the challenge arises in how you blend this data. How do you tie free form comments to data in a repeatable, consistent way? The answer (as is often the case) is a little user education combined with a bit of creativity, resulting in the ability for a user to enter comments that tie directly to your data. In action, it looks a little something like this.

    You can see that clicking on the Bookcases bar returns only comments for that Sub-Category. These comments were not something that was in my source data, but rather something entered by my end-users - my report consumers. Interested? Let's break down what makes this work.


    Step 1

    The first step is to establish a connection to the Tableau Server Postgres database (or any database if you are using an embedded portal of some kind). I use this connection:

    You could conceivably user fewer tables, such as only the Comments table (possibly in conjunction with the Workbooks table), but if you want to display information such as who made the comment, and make sure that you filter the view for only comments on that specific dashboard, you need the above. Here are the connections:

    • _comments.User Id _users.Id
    • _comments.Commentable Id _views.Id
    • _views.Workbook Id _workbooks.Id
    • _workbooks.Site Id _sites.Id


    Step 2

    Once you have built the connection to Postgres, you need to set up the comment sheet that you will display in your dashboard. Design whatever works best for your deployment, but my test sheet looks something like this:



    Step 3

    Convert the comment to something you can connect with your data. You can do this either via blending or dashboard actions. If you have a single field, this would be a good use-case for blending, but if you want to connect more than 1 field (the method I will explain in this post), actions are probably a better and more flexible route. To do this, you need to have a field to blend/pass - this is where the user education comes into play. You need a comment that,  at least in part, matches the field you will be connecting with, which necessitates a common syntax for entering comments. Without this, you will not achieve dependable joins/connections. You can see in the above example, I enter the dimension value which I am commenting on, then a hyphen, then the body of my comment. I then run a split function on the comment to strip out this dimension value. Spaces are not a dependable split, as some dimension items are comprised of multiple words. You know your data best, so pick something that is not a naturally occurring character in your data. Use a split calculation that looks similar to:


    TRIM( SPLIT( [Comment], "-", 1 ) )


    You can now blend this calculated field with your data, or use it in an action. Utilize UPPER() or LOWER() functions into your calculations if you want your end user to be able to match the string, without having to match the case - just make sure you put this on both the dimension field in your data, as well as the split comment field.


    Step 4

    Either blend or establish actions between your data sources. Put your worksheet and other pre-built sheets into your dashboard. In my example, it looks like this:



    While this is useful in its own right, it's mostly a more informative, condensed version of the comments section below the existing view. Adding actions lets you filter this table to any mark you select in the view. If you add actions from individual sheets, this enables you to pass a different field per sheet to filter your comments! I have set mine up as an "exclude all values" filter unless a selection is made. That means if I don't have any marks selected, this table is blank, so as not to be misleading or clutter up my view. There is an added benefit of being able to use cascading sheets, if desired, so that the comments sheet doesn't take up any room unless the user makes a selection.



    The key with this is how you configure the action fields under the Target Filters section of the action dialogue. The source for your action should be coming from your data, using the dimension field whose values your comment will match. The Target field should be the first split of your comment field - that is whatever the user would enter to the left of the hyphen (or whichever symbol you are using for your split). The fields should look something like the below. Note: your Source and Target data sources will generally not be the same, as your Source data source should be your original data and your Target data source should be the comments table (depending which direction the action is going).



    Step 5

    If you have gone the action route, you can use an action from each sheet on your dashboard to match a different dimension as needed. Just configure an action from each sheet to the comments table, making sure to adjust your Source field each time. Remember - once you have set this functionality up, the biggest thing to remember is to train your users to use a consistent syntax when entering their comments. Without this syntax, the fields will not correctly link through the actions, and the comment functionality will not work properly.


    I have attached an example workbook which should help in troubleshooting any issues with actions or calculations.


    Happy commenting!