Search code examples
spotfire

Spotfire: How to resolve ties in top/bottom rule in 'Show/hide items' of a bar chart


I have a Spotfire bar chart where I get data from a column and I have defined a filtered to show the top and bottom 5 items only. However, if there is a tie for the 5th position, the chart shows all the tied values instead of limiting the data to 5 items. How can I limit the display to only 5 values? The tie could be resolved by the order of occurrence in the original table or any such arbitrary condition.


Solution

  • You can achieve by ranking the values with a custom expression. In the ‘Edit rule’ dialog, right click on column and select custom expression. You can add the expression below (adding the desired column and aggregation method).

    As per the documentation: Ties are given rank values depending on optional argument values: "ties.method=minimum" (default), "ties.method=maximum", or "ties.method=first".

    Rank(sum([column]),"ties.method=first")