Products | Versions |
---|---|
Spotfire Analyst | ALL |
Follow the steps below to show full top five bars in a stacked bar chart:
SOLUTION 1:
1). In the Show/Hide rule type, use the following custom expression.
DenseRank(SUM([YAxisColumn]) over (All([Axis.Color])),"desc")<= N ( change N to value the number of bars you want to show ).
2). Select Rule type as Boolean expression and values must be set to [Axis.Value]. See the attached screenshot (Filename: TopNRule.PNG).
For example, for a bar chart with Sum(Sales) on the Y-axis, custom expression "DenseRank(Sum([Sales]) over (All([Axis.Color])),"desc")<=5" in Show/Hide rule and rule type as Boolean and rule value as [Axis.Value] can be used to show the top five complete bars.
SOLUTION 2:
1). Create a calculated column for calculating Dense Rank such as :DenseRank = DenseRank(Count([Yaxiscolumn]) over ([XAxisColumn]),"desc").
2). In the Show/Hide Column, use a custom expression : Avg([DenseRank]).
3). In Rule type select : "Less then or equal to".
4). In Value, enter the value you want to show the number of bars, e.g., 5 . See the attached screenshot (Filename(TopNRuleCalculatedColumn.PNG)).