10 Replies Latest reply on Apr 23, 2012 11:13 AM by Jason Paulsen

    Text shelf allows more than one item to be dropped onto it

    Patrick Mcmahon

      I think I have seen others post this... but this one is soooo useful...

       

      I'd like to be able to drop more than one item on the text shelf so that it would be concatenated on the table...

       

      Of course some control over the concatenation would be nice (e.g. new line, comma, semicolon, parenthesis or user defined

       

      resulting examples might be:  Label (value) or Label - value or Label;value, etc. etc. etc.

       

      Would be nice to be able to have a "text" component that could be put there as well.. so you could, for example, drag a dimension, for a label, then a text component (with some user defined text) and the a measure for the value.

       

      Of course the order (top to bottom) on the shelf would determine the order of the values...

       

      On bar charts, especially, I like to put the label and the value in the bar... I can do one or the other using the text shelf, but not both, since you can't create a calculated field that contains both a dimension and measure.

       

      I know you can use marks, but the arrow makes things messy and you can't get a clean alignment / format...

       

      Ok, feel better now - thanks!

       

      Patrick

        • 1. Re: Text shelf allows more than one item to be dropped onto it
          Joe Mako

          I think what you are asking for can be done with calculated fields. You can combine a dimension and a measure and add a line break with a calculated field like:

           

          [Dimension]+"
          
           "+SUM([Measure])
          


           

          (notice that there is a line break in the quotes inside of the calculated field, that gives it a line break)

           

          There are cases where you need multiple levels of aggregation, and therefor currently require custom SQL or pre-process to get the result sometimes.

          • 2. Re: Text shelf allows more than one item to be dropped onto it
            Patrick Mcmahon

            Joe - interesting... this opens up some additional work, as the Dimension I would like to include is a group, which Tableau does not appear to like including in calculations.  However, since the dimension is actually a numerical representation of a response value (e.g. 1 = good, 2 = very good, etc.) I think I can use the CASE function to test for the small set of possible values and return the appropriate text...

             

            However ----

             

            The chart that I am using is a stacked bar, where the current text field is a table calculation (Percent of Total within Cell), to give me for each row, the percent of the total for each bar.

             

            Basically I am trying to represent for each row, the distribution of responses (totaling 10 to 100% for each row)

             

            I am not sure how to replicate the % of row total calculation in the calculated field.  I can get the # of records that fall into each response value using SUM([Number of Records])... but not sure what incantation of logic gives me something that represents the total number of records in that row to divide by to get the percent.

             

            Make sense??? Any Hints???

            • 3. Re: Text shelf allows more than one item to be dropped onto it
              Jordan Cardonick

              Using the % of row will make this difficult. . . however what you could do is create a calculated field that is something like

               

              CASE [RESPONSE]

                  when 1 then str(COUNT(RESPONSE)+" people answered Good")

                  when 2 . . . etc.

               

              Then have a bar chart setup with Total Count on the vertical axis and [Response] on the horizontal (Might need to create a duplicate if it is a measure and change it to a dimension)

               

              Then place your Calculated field in the text.

               

              Then if you still want % Difference, just create a new table with it and put both on a Dashboard. 

              • 4. Re: Text shelf allows more than one item to be dropped onto it
                Ryan K

                You guys post some interesting solutions. However to make it easier, quicker, and more flexible for a variety of chart types, I have another feature request / solution.

                 

                Here's what I'd like to do, simply. (Please let me know if there's a good workaround)

                 

                I'd like an option in the Mark Label formatting pane to be able to show both the percentage and the value. For example, I have a pie chart of information. My users said, "Well, this looks great. However I'd like to see both the percentage of the whole along with the actual number. Since this is in printed form, I can't hover over it..."

                 

                A simple option to show both would be a terrific start (maybe show one on top of the pie slices and one outside of them - allowing you to change the color for both for good contrast).

                 

                Oh and one more thing - similar to Excel, is there a way to have little pointer lines associate smaller slices with their numerical label?

                 

                Thanks!

                 

                -Ryan

                • 5. Re: Text shelf allows more than one item to be dropped onto it
                  guest contributor

                  I get an error: "Can't add a string and an integer"

                   

                  Suggestions?

                  • 6. Re: Text shelf allows more than one item to be dropped onto it
                    James Baker

                    Wrap the integer in STR([your int]) to convert it to a string.

                    • 7. Re: Text shelf allows more than one item to be dropped onto it
                      Brad Holtz

                      [Sector]+"

                      "+STR(COUNT([RespondentID]))

                       

                      Where [Sector] is a label and [RespondentID] is a unique numerical record identifier.

                       

                      gets error: "Cannot mix Aggregated and non-aggregate arguments to function"

                       

                      What I'm trying to accomplish is to get a text label on a pie chart to look like:

                       

                        SECTORNAME

                          31%

                       

                      Suggestions?

                      • 8. Re: Text shelf allows more than one item to be dropped onto it
                        Patrick Mcmahon

                        Brad - sorry I can't help, but can confirm that is the same errors I got when trying to accomplish this.  I believe the problem stems from the fact that you are likely aggregating a field, therefore Tableau doesn't have a clear way to know which value of sector to assign to the result of the RespondentID count...  To me it seem logical, in that if Sector was one of the dimensions, then as long as the data is aggregated by Sector, you would know which sector to apply, however I don't think Tableau has that kind of logic built into it today...

                         

                        Patrick

                        • 9. Re: Text shelf allows more than one item to be dropped onto it
                          Jordan Cardonick

                          The issue is with the STR(COUNT(RespondentID) since Sector is not aggregated.

                           

                          What you CAN do is change your formula to this

                           

                          STR(MAX(Sector)+" "+STR(Count(RespondentID))

                           

                          This way it tricks Tableau into seeing this as two aggregation functions.

                           

                          What you'll need to do next though is throw Sector on the worksheet in front of your new calculated field and then hide it so it will give you all Sectors and their counts.

                          • 10. Re: Text shelf allows more than one item to be dropped onto it
                            Jason Paulsen

                            This worked for me perfectly! Thanks Jordan.