4 Replies Latest reply on Apr 17, 2018 1:21 PM by ahmed.arafat

    Stacked Bars with Trend Lines


      Hello all,


      Is there way to include a trend line with a stacked bar? Here is the example I am working with. Also attached isa workbook with the data.



      Any suggestion is greatly appreciated.




        • 1. Re: Stacked Bars with Trend Lines
          Brenden Goetz

          Hi Ahmed -


          Trend lines are not supported with Stacked Bars (scroll to the very bottom of the Trend Line online help). Additionally, to have the capability to use Trend Lines, the fields used in your view must be able to be interpreted as a number. Looks like there are some categorical dimensions involved (e.g. Title) that prevent the use of Trend Lines.


          With that in mind, depending on what you're trying to do, you may be able to create a dual axis chart, use a trend line on the second axis, and hide those marks with your stacked bar chart. However, I suspect that you might have to rethink the design to use a Trend Line more appropriately - specifically using it on a worksheet where the fields can be interpreted as numeric values.


          Hope that helps!

          • 2. Re: Stacked Bars with Trend Lines
            Jeevan Krishna

            Hi Ahmad,


            I do not have access to your dashboard. I will explain the same with super store data, If you are looking for something like this, you can replicate following the below steps



            Consider you want to show sales as stacked bar by segments and profit as a trend-line(We will come to the highlighted part later)


            Create dual-axis by right-clicking on the second field



            Click on Sum(Sales) in the above highlighted region and change this from line to bar.


            Drop Segments by which you want to build stacked bars onto color pill



            Discussing about the highlighted region in the 1st Image, these options allow us to control both the fields in terms of mark type used, color etc.. separately which allows us to create a line and a stacked-bar for 2 different fields in a single viz.

            1 of 1 people found this helpful
            • 3. Re: Stacked Bars with Trend Lines

              Thank you Brenden for your suggestion.



              • 4. Re: Stacked Bars with Trend Lines



                Thank you so much. I was able to replicate and get what I wanted to accomplish. Here is a pic of how it looks like now, a bit funky with the colors, but playing with it.


                Greatly appreciated!