7 Replies Latest reply on Nov 16, 2016 5:53 AM by James Wright

    how to put 4 measures into one graph

    Zhaoning Liang

      Is it a way I can put 4 measures into a same graph?

       

      Two of the measures share the left axis with the display format as one bar and the other one as a line, if it cannot make it, then use two bars instead, but one bar should be wider (it is a SLA) than the other in order to differentiate them.

      Two of the other measures share the right axis with the display format as two lines.

       

      Can I put all these 4 measures into one graph. I tried but it seems doesn't work. BTW I am using tableau desktop version 9.

        • 1. Re: how to put 4 measures into one graph
          D Barnetson

          Hi Zhaoning,

           

          Depending on your measures and the data that you are working with, you can try this:

           

          Keep your first 2 measures as individual columns in you data set (i.e.; Sales & Profit).

           

          Then you can Pivot the other 2 measures when you're in the data source tab of Tableau.

           

          To do this, highlight the 2 measures (i.e.; Quantity & Discount).

          Then click the drop down arrow and selecting pivot.

          You'll now see 2 new columns: 'Pivot Field Names' & 'Pivot Field Values'.

           

          Now, go to your sheet and start placing your pills on the following shelves in the order below:

           

          1. Drag your Date dimension to the columns shelf and change to 'month'.

           

          2. Drag the measures to the rows shelf in the following order (starting from the left): Measure 1, Pivot Field Value, Measure 2.

          3. Change both measures 1 & 2 to a bar and the pivot value to a line. See picture above.

          4. Right click on the pivot value pill and make measure 1 and the pivot value a 'dual axis'. At this point you should have a bar graph with a line graph on top and a bar graph under it.

          5. In the top left corner of the bottom bar graph's axis, you will see that you can grab the graph buy clicking on the corner. Move it up, over the top graphs axis until you see 2 bars. (this means that you can combine the 2 graphs into 1.

          6. You should now see a line graph and 2 bar graphs.

          7. If so, remove the 'Measure Names from the columns shelf.

          8. Lastly, you will need to change the dimension from 'Measure Names' to 'Pivot Field Names' on the line color shelf.

          ...and there you have it:

          Hope this helps.

          Don

          2 of 2 people found this helpful
          • 2. Re: how to put 4 measures into one graph
            David Walker

            Hi Zhaoning,

             

            If i'm reading your intent correctly, then this post by James Wright should help:  https://www.interworks.com/blog/jwright/2012/06/18/multi-measure-dual-axis-charts#ninja

             

            David Walker

            • 3. Re: how to put 4 measures into one graph
              Zhaoning Liang

              thanks for the detail input. however, I don't see the "pivot" option in the drop down list  when I try to follow your suggestion. Do you know why?

               

              • 4. Re: how to put 4 measures into one graph
                Zhaoning Liang

                thanks for the reply. But the method in this post looks like can just add 3 measures, how to add the 4 measure, for example, another bar and combine it to the grey bar and share with the same left axis?

                • 5. Re: how to put 4 measures into one graph
                  David Walker

                  Zhaoning:

                   

                  this technique relies on creating a dual axis using filtered Measure Names/Values.  there are many different variations, but the common denominator is one measure combined with Measure Names/Values.  as you cannot duplicate Measure Names/Values, then the result is limited to a combo with one measure of one mark type and multiple measures of another [mark type].

                   

                  the beauty of D Barnetson's solution is that it bypass this limitation.  you effectively have another Measure Names/Values combo.  Don showed four measures (as requested), but by changing the filter on Measure Names/Values and adding more columns to the pivot, you can add more.

                   

                  So the answer is ... use Don's technique. 

                   

                  David Walker

                  • 6. Re: how to put 4 measures into one graph
                    David Walker

                    pivot is limited to fields in the data source.  you can't pivot on calculated fields.

                    • 7. Re: how to put 4 measures into one graph
                      James Wright

                      An oldy-but-goody. Thanks for the mention and the memories, David!

                       

                      The techniques there should still be valid, as well as the inherent limitations you describe. Ultimately, there are several less sustainable workarounds for the limitation of one MV/MN display, but I would probably suggest that there are better ways to detect, display, and act on complex multi-variable relationships than a simple combined axis chart.