Spotfire® Web Client User Guide

Top Category

The Top Category expression shortcut is used to quickly visualize a winning category in a categorization visualization. For example, it can be used for coloring a map chart with winning political parties or products.

Example

Below is a feature layer map showing the different regions in Sweden. It is colored by the top category political party, based on the number of votes that each party got in that region.



The expression used on the Color by axis:

UniqueConcatenate(If(Max(Sum([Votes]) OVER (Intersect([Party]))) OVER (Intersect())=Sum([Votes]) OVER (Intersect([Party])),[Party],null))

The inner aggregation is what is calculated first: in this example it is the sum of votes per party. The number of votes is split by region as defined by the categorical axes in the visualization only (handled by the empty Intersect() statement). Then, the party with the max number of votes is found, and if the smeared number of votes value for a row equals the max number of votes, the name of that party is sent along to the next step, otherwise the result is null, since parties with a sum(Votes) lower than max are not interesting. All parties that have the max number of votes are concatenated to a list so that ties between several parties with the max number of votes are handled. In order to avoid the same party name being shown more than once, it is the unique concatenate function that is applied to the result.

See also Intersect().

The column selector in expanded mode

In the installed client, the extended column selector offers controls that make it easy to change various parameters in the expression shortcut:



Display name Optionally, specify a different display name instead of the default "Top Category ([ Category Column Name] for InnerAggregation([ Column Name]))".
Category column Specify the categorical column to find the winner in.
Inner aggregation Specify the aggregation method of the inner aggregation where you want to find the winner. The default aggregation is sum.