I have a results table with 100 players and their place respectively. I would like to create a filter that when in the filter user selects player, who finished in 50th place, it would show only players who finished 5 places above and 5 player below from filtered player in tableu
-
Your question presents a bizarre kind of contradiction. See, if you filter someone's name, you only have that person's record. Now, If you are already filtering the data, how will you display anything apart from that data? Like the Top 5 or the bottom 5? – Debayan Mar 12 '23 at 04:08
-
1Use a parameter to identify your selected player instead of a filter. You can either use a parameter control, or a parameter action to allow the user to choose the player. – Alex Blakemore Mar 20 '23 at 20:48
-
1If your data does not have a rank attribute, you can compute rank with a table calc. Either way, you can write a boolean calculated field to identify the ranks you wish to display and put it on the filter shelf. If you are using a table calc, the effect is to just hide the other data rather than filter it – Alex Blakemore Mar 20 '23 at 20:49
-
1Regardless, you might want to read about table calcs, table calc filters and LOD calcs. You're problem is not too tough, but it requires starting to learn a bit about these more advanced features. – Alex Blakemore Mar 20 '23 at 20:50
-
Hi @AlexBlakemore! Thank you for valuable insights! I have rank column, but still cant figure out, how to put this into working... Tried creating calculated field with condition: if[Rank] <= [Rank] - 5 or [Rank] <= [Rank] + 5 THEN [Dalyvis] END This still confuses me, in example: I want to see 5 rows above and 5 row below from 100 rank player(John). Result should be 95-99 and 101-105 ranked players. With possibility for viewer to change selection for another player like Steve 50th rank and see 45-49 and 51-55 players – A99 Apr 02 '23 at 19:12
1 Answers
Use a parameter to identify your selected player instead of a filter. You can either use a parameter control, or a parameter action to allow the user to choose the player
If your data does not have a rank attribute, you can compute rank with a table calc. Either way, you can write a boolean calculated field to identify the ranks you wish to display and put it on the filter shelf. If you are using a table calc, the effect is to just hide the other data rather than filter it
You need to keep in mind that you have two different things that you are calling [Rank], and you should distinguish them somehow. One value is the rank of the selected player. That should be a calculated field based on a parameter - where the parameter records the selected player. something like Selected_Players_Rank defined as { FIXED : MIN(IF [Player] = [Selected Player] THEN [Rank] END) }
Note, this is a fixed LOD calc. The second [Rank] is just the rank column showing each players rank.
Then you can define a boolean calculated field called Within_5_Positions_Of_Selected_Player? as ABS([Rank] - [Selected_Players_Rank]) <= 5
Then use that field as a filter
In this case your ranks are pre-computed and included in the original data. That means you can't apply filters, say removing certain players from the mix and then interactively compute new rankings based on your filter choices. If that fits your situation great, precomputing the ranks is simple and efficient. If you need to dynamically compute ranks based on interactive filter choices or parameter settings, you'll need to adjust this approach slightly to either use table calculations instead of LOD calculations, or to apply a bit of custom SQL to use a windowing query.

- 11,301
- 2
- 26
- 49