3 Replies Latest reply on Feb 13, 2019 7:29 AM by Russell Goldin

    Splitting an area chart by dimension while using the same mark

    Chai Reddy

      So I' have a combination Area/Line chart that isn't stacked.

      I want to split this chart in such a way that the total of each measure stays the same but it's split by color/border based on a dimension.

       

      When I add the dimension to the detail view, it creates a separate area/line chart for each dimension rather than split the same mark.

      I've attached a screenshot of what I want and what's actually happening.

       

       

       

       

      What's happening:

       

      What I need

      tableau area.PNG

       

       

      Hope the pictures explain this confusing issue better.

      Thanks in advance.

        • 1. Re: Splitting an area chart by dimension while using the same mark
          Russell Goldin

          Hi, I have attached a TWBX that seems to solve this problem.

           

          Highlighting an individual Segment in my example shows that you see the breakdowns of each dimension while different dimensions are stacked against themselves (for lack of a better phrasing).

          2018-11-09_15-43-56.jpeg

           

           

          2018-11-09_15-46-21.jpeg

           

          The way it works is that each part builds upon the others.  Here is the calculation for my [Sales by Segment] calculation:

          IF [Segment] = 'Consumer'

          THEN {include [Category]:sum(if [Segment]='Consumer' then [Sales] end)}

          ELSEIF [Segment] = 'Home Office'

          THEN {include [Category]:sum(if [Segment]='Home Office' or [Segment]='Consumer' then [Sales] end)}

          ELSEif [Segment] = 'Corporate'

          THEN {include [Category]:sum(if [Segment]='Corporate' or [Segment]='Home Office' or [Segment]='Consumer' then [Sales] end)}

          END

          The consumer segment is the sum of sales in only the consumer segment.  Then the Home Office segment is the sum of both Consumer + Home Office.  Finally, the Corporate is Consumer + Home Office + Corporate values.  This calculation should drive your axis but you’ll be able to put the original measure (in this case, Sales, on the tooltip to get the correct value.  The stacked values won’t, of course, align correctly with the axis on the chart.

           

          Note - This view doesn't prescribe to visual best practices and there are better ways to display the data.  But at least we now know that it's possible. 

          1 of 1 people found this helpful
          • 2. Re: Splitting an area chart by dimension while using the same mark
            Chai Reddy

            Thanks for the response Russell, I had some time to try this again and I made some headway using a similar technique.
            As I mentioned before, I would only be looking at two product lines at any given time, so I made two parameters for the Product Line field.
            Doing this only solved half of the problem, i.e I was able to create create a measure for each product line and placed them on the measure values and plot them as the Area chart.


            Now, since the sheet uses two mark types, I'm unable to make the same grouping on the non Measure value section, i.e the line graph.
            I tried doing an if statement but because of the way it works, if the first condition on product line is met, the second condition where I combine the two product lines will not contain the data that met the first condition.


            Is there any solution to this? Is there a way to enclose an if statement in an LOD where the output is a dimension?

            • 3. Re: Splitting an area chart by dimension while using the same mark
              Russell Goldin

              Can you provide an example?  That would be really helpful in looking at your specific situation and helping get to a resolution.