2 Replies Latest reply on Aug 4, 2016 7:28 AM by Frank Casella

    Filtering by multiple selections by parameter

    Frank Casella

      Hello,

       

      I'm using Tableau 9.2 and am trying to include multiple elements within a single dimension as an option for a parameter. something like this...

      Parameter Valuefilter [Segment] dimension to include [Segment]=
      Option 1Segment 1
      Option 2Segment 2
      Option 3Segment 3
      Option 4Segment 4
      Option 5Segment 2 + Segment 3 + Segment 4

       

      so, if I select option 5, I want it to show me the sum of all items in segment 2, segment 3 and segment 4.  I don't want to see each segment individually.  I've tried using sets and logical operators, but I haven't had any luck.  Here's my latest attempt if it helps...it works for Options 1 through 4, but not Option 5:

       

      IF [Segment to Show] = 'Option 5' THEN

           IF ATTR([SEGMENT])='Option 2' OR ATTR([SEGMENT])='Option 3' OR ATTR([SEGMENT])='Option 4' THEN [Sales (R12)] END

      ELSEIF [Segment to Show] = ATTR([SEGMENT]) THEN [Sales (R12)]

      ELSE NULL

      END

       

      if it's material, [Sales (R12)] is a calculated field: SUM([Sales]) + LOOKUP(SUM([Sales]),-1) with the table calculation along the field [R6 Date].  Each R6 date contains 6 months of non-overlapping sales data.

      the basic data structure is a straight table with headers: R6 Date, Segment Group, Segment, and Sales.

      Heading nameData typeDimension/Measure
      R6 DateString (date in MMM yyyy format)Dimension
      Segment GroupStringDimension
      SegmentStringDimension
      SalesNumberMeasure

       

      I have the [SEGMENT] dimension in the Marks detail.  I've also tried it with the [SEGMENT] dimension as Rows.

      Thanks for any assistance you can provide.

       

      -Frank

        • 1. Re: Filtering by multiple selections by parameter
          Mahfooj Khan

          First calculate the segment sales using your actual sales measure. I've used Superstores data to create a similar scenario like yours.

          I've create a parameter like yours using Segment dimension.

          Then created a calc field to calculated the sales of segments using parameter.

          Then using segment sales calculated measure to lookup previous value.

          Feel free to ask If you've any question.

           

          Mahfooj

          3 of 3 people found this helpful
          • 2. Re: Filtering by multiple selections by parameter
            Frank Casella

            Excellent!  Thanks so much!  It looks like my mistake was using the [Segment] in the detail.  By filtering [Segment] explicitly within the calculation, it eliminates the need for this.  I'm guessing because [Segment] was in the detail, it wouldn't allow it to show values that didn't match to a single [Segment],

             

            -Frank