4 Replies Latest reply on Jun 8, 2018 10:16 AM by Julianne Jochym

    Rank and Filter w/ Parameters

    Julianne Jochym

      I have a simple graph ranking revenue for a number of teams. I'm trying to filter the worksheet so that it shows only the team selected with the "Team Parameter" but every time I try it filters out all other teams and ranks it 1/31. How do I set this dashboard up so that it shows only the rank of the selected team in the Team Parameter?


        • 1. Re: Rank and Filter w/ Parameters
          Joe Oppelt

          Without an actual workbook I can't give specifics, but you want to have a table calc as a filter so that it leaves all the other teams in the underlying table.


          So if you have a parameter for the user to select a team, make a filter something like this:


          LOOKUP( (if [team name] = [team parameter] then 1 else 0 end), 0 )


          There are two arguments to that LOOKUP.  the first is an IF statement that results in 1 or 0.  the second is the value 0 to tell tableau to look at the current mark (for each mark).

          When you put that on the filter shelf you will have choices of value 1 or 0.  Select for 1.  This will bring only the selected team onto the viz.  But all the other teams are still in the underlying table, and your RANK will take them all into account.

          • 2. Re: Rank and Filter w/ Parameters
            Julianne Jochym

            Thanks so much Joe, I really appreciate the quick response.


            I'm getting an error message using the filter you provided above. Attached is a packaged workbook with dummy data - are you able to test it in there?


            Thanks again!

            • 3. Re: Rank and Filter w/ Parameters
              Joe Oppelt

              See attached.


              Note:  I changed the color pill to discrete so that you get individual colors for each value instead of a spectrum.


              The error you were getting was probably the aggregate error.  (Must be aggregate.)

              LOOKUP is a table calc, so components in it must be aggregated.  Wrapping a non-aggregate in ATTR() is a common way to fix that.  Usually we are messing with measures, so they would get SUM() or MIN(), etc., as the table calc expects.

              • 4. Re: Rank and Filter w/ Parameters
                Julianne Jochym

                This is perfect and my dashboard is working, thank you so much for your help!