1 Reply Latest reply on May 28, 2015 9:41 AM by Simon Runc

    Updating tooltips when hierarchies are expanded

    Andrew LaPrise


      ** Essential Exposition **


      ** I'm using Tableau 9, **

      ** and I'm going insane **



      In the attached example workbook (which uses the Sample - Superstore dataset), I created a Group from Region (it's meaningless, and just for the purposes of this example).  I then put that group in a hierarchy with Region.


      • Region Hierarchy
        • Region (group)
        • Region


      Then I put the hierarchy into the chart, with the intention of the user being able to expand and collapse that hierarchy at will.  Here's how I defined the tooltip, and what the resulting view looks like:


      Screen Shot 2015-05-07 at 7.47.05 PM.png


      Screen Shot 2015-05-07 at 7.45.16 PM.png


      When the hierarchy is collapsed, the <Region (2)> field is not displayed.  That's great news!  I don't want to show it, because we're not considering that level of aggregation.  However, obviously I don't get the same effect when the hierarchy is expanded.


      Screen Shot 2015-05-07 at 7.48.51 PM.png


      It shows both fields.  I would like to hide the Group field when the hierarchy is expanded, but I can't for the life of me figure out how.


      Here's one example of how I've tried to remove it so far.  I had hoped that maybe the <Region> field is NULL when the hierarchy is collapsed, and maybe that was why that line disappeared.  So I thought maybe I could create a calculated field that would be NULL when the <Region> field was not NULL.  Then I could put that new calculated field on the same line as the Group field, forcing it to be NULL whenever the <Region> field was available (i.e. the hierarchy was expanded).  Here's what that looked like:


      Screen Shot 2015-05-07 at 7.52.11 PM.png


      Screen Shot 2015-05-07 at 7.53.09 PM.png


      But that just yielded a big pot of diddly.  I guess <Region> isn't NULL in the underlying data, which is obviously great news, because that's definitely how data works, but still a bummer for the sake of this effort.


      An important note is that you can't use Group fields in Calculated Fields, and I have absolutely NO idea why.


      Does anyone have any idea how I could pull this off?  Thanks so much for any tips or help you might be able to provide!

        • 1. Re: Updating tooltips when hierarchies are expanded
          Simon Runc

          hi Andrew,


          I couldn't quite solve the problem as stated but have got fairly close!


          If you look at the attached I created a ToolTip label field as you did, but used the below formula


          IF MAX([Region])=MIN([Region]) THEN ATTR([Region]) 

          ELSEIF MAX([Region Group Calc])=MIN([Region Group Calc])THEN ATTR([Region Group Calc])



          This might look a bit odd, but when you expand out the hierarchy Region no longer equals Region, so I've taken advantage of that fact. One thing to note the order of the IF/IFELSE need to be the same as your hierarchy.


          The reason (it's not an exact solution), as you'll no doubt have seen, is that I've no longer used groups. I've actually created the groups using an IF formula. I had to do this as you can't, annoyingly!, access Groups in formulas.


          Hope this helps