These examples are made with the rank (VRank) function, but may be applied in a similar manner to the HRank function. However, note that the HRank function is relevant only to pivot tables.
Study the two one-dimensional straight tables below:
The two tables are the same, but the first one is sorted by the first column while the second one is sorted by the last column. This exemplifies the basic functionality of rank. The highest value has the highest rank (lowest ranking number).
The rank function always returns NULL in total rows.
Study the two-dimensional pivot table below:
This table is based on the same data as the two tables in the first example. It is now possible to see how the current column segment is the inner grouping in the multi-dimensional case. The Month field within group A is ranked separately from the Month field in group B. By introducing the total qualifier an overall ranking can again be achieved.
This example will demonstrate the effect of the different modes for the numeric representation of the ranking. Study the table below:
The third column shows the ranking in text representations while column 4 - 8 shows the number representation of the same ranking in different modes. The expression in each column is:
num( rank( sum( X ), mode ))
where mode is a value from 0 to 4:
- Mode 0 (default) Rows 2 and 3 share ranking but are clearly on the lower half of the total ranking. Their number representation is therefore rounded downwards to 2. Rows 4 and 5 share ranking too, but fall just above the middle of the ranking table. Therefore they get a number representation of the average of the first and the last rank in the column ((1+8)/2=4.5). This mode is especially useful when you want to use Visual Cues to mark the data ranking highest and lowest within a group.
- Mode 1 In both cases the lower ranking figure within the group is used, i.e. 2 for rows 2 and 3, 4 for rows 4 and 5.
- Mode 2 In both cases the average of the low and high ranking within the group is used, i.e. 2.5 ((2+3)/2) for rows 2 and 3, 4.5 ((4+5)/2) for rows 4 and 5.
- Mode 3 In both cases the higher ranking figure within the group is used, i.e. 3 for rows 2 and 3, 5 for rows 4 and 5.
- Mode 4 Each row is assigned its own distinct numeric value. The order within groups sharing a ranking is determined by the sort order of the chart's dimensions.
This example will demonstrate the effect of the different formats for the text representation of the ranking function. Study the table below:
Columns 3 - 5 show the text representation of the same ranking function with different format values, where format is a value from 0 to 2:
- Format 0 (default) Rows sharing ranking are shown as 'low value - high value', e.g. '2 - 3' and '4 - 5'.
- Format 1 Rows sharing ranking always get the number of the lowest rank as text representation, in this case e.g. 2 for rows 2 and 3.
- Format 2 One row in each group sharing the same ranking gets the low rank number as text representation, while the other rows within the group get a blank string. The order within the groups sharing a ranking is determined by the sort order of the chart's dimensions.