7 Replies Latest reply on Oct 19, 2016 10:33 AM by Suraj Shah

    Combination of Labels and Reference Lines

    Suraj Shah

      Hi,

       

      The attached workbook was built in Tableau 10.

       

      Problem:

      View 1: Shows percent of sales in each segment (Table down). The values are shown as Labels at the centre of each column. However, as a Reference Line, I want to show the Total Sales in that segment, which can be seen in View 2. I want a combination of both views as my output.

      When I change the reference line, it changes the scale on my y-axis to match the reference line thus diminishing the graphs.

       

      See screenshot below for convenience.

       

      Am I missing something obvious, or should I not use reference lines for my purpose?

      Help will be much appreciated.

       

      Thanks,

      Suraj

       

      Reference Line Question.PNG

        • 1. Re: Combination of Labels and Reference Lines
          Joe Oppelt

          See Sheet 4 of the attached.

           

          You can use Dual Axis to put both things on one viz.

          • 2. Re: Combination of Labels and Reference Lines
            Suraj Shah

            Hey Joe,

             

            Thanks for the quick reply.

             

            To clarify the problem a bit more, I intend to see the SUM(Sales) only as a reference line and not as a mark/chart. I don't intend to see the 'circle' as the marks.

             

            If I change the calculation on the reference line to SUM(Sales) it changes my chart. Please see the image attached.

             

            Thanks.

            Reference Line Question2.PNG

            • 3. Re: Combination of Labels and Reference Lines
              Mahfooj Khan

              Hi Suraj,

               

              Is that what you wanted?

              Workbook attached for your reference. Have a look and let me know If this help.

               

              Mahfooj

              1 of 1 people found this helpful
              • 4. Re: Combination of Labels and Reference Lines
                Devansh Vora

                Hello Suraj,

                 

                This is the another way you can do it i.e. percentage & total of sales in the same viz.

                • 5. Re: Combination of Labels and Reference Lines
                  sayali dengale

                  Hie suraj, may be this is the solution of your question.

                   

                   

                  • 6. Re: Combination of Labels and Reference Lines
                    Joe Oppelt

                    Suraj -- I'd like to understand your need better.  Are you saying that you want to have Sheet1 look like the left side of your dashboard screenshot, but also have three lines superimposed on that chart where your three SUM(sales) are on the left side of your dashboard?

                     

                     

                    Trying to put them both together on the same chart makes the two axes step on each other, and I think the table calcs have something to do with that.

                     

                    Here are some other things I tried.

                     

                    In Sheet 1 I made a separate table calc called [Sum Sales] that does the window sum of the sum(sales) so that you get the three values per [Segment].  (You'll notice that I have commented out some stuff in that calc.  Initially I had [Category] on the detail shelf got the [Sum Sales] mark, and so I was getting three identical "copies" of the value, one for each category, so I told the calc only to display for the first one.  But then I realized I could yank [Category] off the detail shelf for that mark, and the INDEX() stuff became moot.  It doesn't break anything, but it's not needed.)

                     

                    Anyway, I have two separate table calcs on ROWS in Sheet 1.

                     

                    In Sheet 5 I made it dual axis.  (I think this is the approach you're going to have to take, BTW, so I'm still driving this with a Dual Axis solution.)

                     

                    Now see Sheet 6.  I changed the mark type for [Sum Sales] to shapes.  I just chose one of the stock shapes, but you can create an actual line if you want.  This approximates what you are looking for.

                     

                    Back to the table calcs and reference lines stepping on each other, take a look at Sheet 7.  Here I made a reference line on the axis for [Sum Sales] that us the SUM(sales).  Notice that Tableau totals up all three Segments for the reference line.  But click on an individual one, line Consumer.  Now the reference line drops to the value for that individual segment.  So in a convoluted way it's doing what you are looking for, but not in a way you probably want to see it.

                     

                    Maybe the "Shapes" approach in Sheet 6 will serve your purposes.  Let me know what you think.

                    1 of 1 people found this helpful
                    • 7. Re: Combination of Labels and Reference Lines
                      Suraj Shah

                      Hi All,

                       

                      Thank you all for replying to this.

                       

                      Mahfooj: Thanks. This is exactly what I am looking for. I think it's a bit tedious than I was hoping, but it gets my work done. I wish there was an easier way.

                       

                      Devansh, Sayali: Thanks both for your suggestions. It isn't quite what I was looking for.

                       

                      Joe: Thanks for the different attempts and the detailed explanation. Apologies if I wasn't super clear in my explanation. I was looking for the exact same output as Mahfooj has suggested. I do like your approach of using shapes and I could just replace the arrow with a line, but unfortunately it still wouldn't be on the top of the bar like I want. You may have already got an idea from Mahfooj's image, but if it helps clarify, I do want to use the Table Calc (Table Down-% of total) for all my bars. Thus all bars will be of the same height. On top and only on top of each bar, do I want to see the labels or reference line for Sum Sales in each segment.

                       

                      Thank you all for working on this.

                      Much appreciated.

                      Suraj