2 Replies Latest reply on Oct 11, 2018 11:32 AM by John Cantu

    Determine dimension value based on Index

    John Cantu

      Hi Tableau Community, looking for a little help here.

       

      I've attached a sample workbook of what I'm trying to accomplish.

       

      I'm basically using an Index() in order to 1. limit the user's selections that display in the graph to only two, and 2. maintain a static color assignment since there are multiple dimensional attributes and Tableau assigns a different color to each. I want to keep the colors to only 2 and the same regardless of what is selected. Now, because I'm using the index as the color, I'm not able to convey to the user what each line graph represents (label) using the legend. I know I can just drop the dimension into the Label marks card, but the real data strings can be long and sometimes will not show because of overlapping. What I'd like to do is include the "legend" in the title. I can color code each value to represent the color of the line graph.

       

      Having some issues extracting the value and displaying it properly. I'm wondering if anyone would know how to solve or have other suggestions?

       

      Greatly appreciated!

        • 1. Re: Determine dimension value based on Index
          Michel Caissie

          John,

           

          So if I understand correctly you want to get rid of  "&" in the title.

           

          Because Strategy is in the lod of the view, since your labels returns for each value of Strategy, either  "empty string" or the Strategy value, you get  "empty string" & Stratx in the title,  which corresponds to all the values returning by your calculation labelx.

           

          So what you need is a calculation returning the label value for every row, this way the title will display a single value. I first tried using the Window_min and Max  of Strategy, but since the user can select more than 2 Strategy,  the label2 would show the top 3, while only top 1 and 2 are in the view.

           

          But since, the view always show the 2 min of the selections, you can resolve this using lod and putting Strategy in context.

          The first label will simply be

          {MIN([Strategy])}

          and the second

          {MIN(if [Strategy] != [firstStrategyLabel] then [Strategy] end)}

           

          You can see the difference on sheet validateData.

          Make sure the Strategy filter is in Context, in order for this FIXED lods  to compute after the filtering.

           

          Michel

          1 of 1 people found this helpful
          • 2. Re: Determine dimension value based on Index
            John Cantu

            Michel, thank you so much! I definitely need to read up a little more on the order of operations with filters. I didn't even think to leverage the Context filter capability. I definitely understand how the LOD calculation makes sense here.

             

            Again, I really appreciate your help! Thank you.