2 Replies Latest reply on Mar 28, 2018 11:14 AM by Keegan Keplinger

# Select row of interest, compare to others, but only display row of interest results (aka hide rows of non interest or hide rows returning null)

Let's say I have three people running a marathon, they get three different times.  I don't care who is first place - I care about a particular runner.  I want to make a small card-size dash that says "Runner 5604 placed second" based on their RANK() but not have it display what every other runner ranked.  This is a metaphor for my data (which is proprietary and cannot be shared).

Currently, I use RANK() to rank the runners, then I have a tableau calculation that assess a) whether they are the "runner of interest" and b) what rank they got.  The winner, depending on their rank, will have a different generated sentence.  I use:

if attr([Runner of Interest])='isROI'

then

if [Index]=1

then 'Runner got first place!'

elseif [Index]=2

then 'Runner got second place.'

elseif [Index]=3

then 'Runner lost....'

END

END

This results in the other two runners getting "null" values (which is perfect) - but... in the final dash, I don't want the other two runner mentioned or shown.

I've been able to isolate the winners using "top N" filters (or INDEX() when TOP N failed due to filtering order) but I can't figure out how to isolate based on "interest" - i.e. some set of rows whose columns meet a certain condition (in this case, when [Runner of Interest]="isROI").

Thanks!

• ###### 1. Re: Select row of interest, compare to others, but only display row of interest results (aka hide rows of non interest or hide rows returning null)

Hi Keegan,

• Create a calculated field, [ROI Filter]: LOOKUP(ATTR([Runner of Interest]),0).
• Drag [ROI Filter] to the Filters shelf, and check 'isROI' to include only that value.

To use the field [Runner of Interest] as the filter would show any selected runner as 1st, as Tableau first filters for the runner and then does the Rank().  Filtering on a field that uses a table calculation (such as LOOKUP) causes the filter to be applied after table calculations (including RANK), and so the rank of the runner is preserved while the other runners are filtered out of the display.

• ###### 2. Re: Select row of interest, compare to others, but only display row of interest results (aka hide rows of non interest or hide rows returning null)

Thanks for your reply, Eric.  Unfortunately, when I implement the ROI filter with 'isROI', the other runners disappear and the runner of interest, who was in second place, now goes to first place, so the comparison is lost still (I'm using rank to determine runner placement).

UPDATE:  the comparison was only lost when I removed the pill "Runners" showing each runner.  So your answer actually works, I just need to hide instead of remove that header.  Thanks!