3 Replies Latest reply on Feb 12, 2019 1:18 PM by Paul Wachtler

    Anyway to make text labels appear on distinct lines?

    Sarah Lander

      This is such a small issue, but I've spent forever trying to find a solution and haven't had any luck...


      I've been trying to make a table of names similar to the image below.


      The issue I'm having is that some names appear on the same line, which makes it difficult to read. I can manually adjust the column width to get each name on a new line, but the real data varies more in length so I'd like to find a better solution.


      I know tableau isn't made for text tables, but I'd really appreciate if anyone has any ideas on how to do this!


      Screen Shot 2019-02-12 at 3.48.56 PM.png

        • 1. Re: Anyway to make text labels appear on distinct lines?
          Joe Oppelt

          It's not going to be as straightforward as you might hope.  [Name] is a dimension.  It's going to place as many marks as needed in the respective grid, and Tableau is going to put them there in its own formatting.


          You can make your own list and put line breaks.  It takes a table calc to do that.


          Go to Sheet 1(2).  (Ignore the messiness.)


          HEre I have made a calc called [index].  and I used "Edit Table Calc" to force index to give me a number from 1-through-N for the number of names in the block.  Right click on the index pill and select edit table calc.  You'll see that I told it to run along the [name] dimension.


          Now that I have the proper addressing, all other table calcs need to be set to that as well.


          I created a calc called [Build a List].  It uses the PREVIOUS_VALUE function.  this says to look backward one index value, and grab that value, and (in this case) add the next name to the list.  (If I'm on the first index, just grab the name.)


          But here's the trick.  That calc has a carriage return in it.  I have entered a carriage return between the opening and closing quote marked in red:


          IF [index] = 1 then ATTR([Name])

          else PREVIOUS_VALUE(" ") + "
          " + ATTR([Name])


          You can see that as the calc progresses from name to name, the list builds in that calc.


          Go to Sheet 1(3)


          Here I made one more calc to grab the max value of that list.  A step I did not display is that this value lives on every row.  It's identical for all names within a given block.  And since I only want to see one of the copies of that calc, I filtered the sheet to display only index=1.


          And there you have the list under your control.

          • 2. Re: Anyway to make text labels appear on distinct lines?
            Sarah Lander

            This is exactly the type of solution I was looking for, thank you so much!

            • 3. Re: Anyway to make text labels appear on distinct lines?
              Paul Wachtler

              Hi Sarah,


              Here's one solution.  Create an index field that's simply:



              Put that next to Group on your rows shelf.  Set it to discrete and to calculate using Name


              This will put each name on a separate row.  Then right click on your index field and deselect "Show Header" which will hide the field and give you this:


              Let me know if you have any questions.




              1 of 1 people found this helpful