Top - chart function
Syntax:
Top([TOTAL] expr [ , offset [,count ]])
Return data type: dual
Arguments:
Argument | Description |
---|---|
|
The expression or field containing the data to be measured. |
|
Specifying an Specifying a negative offset number makes the Top function work like the Bottom function with the corresponding positive offset number. |
|
By specifying a third parameter count greater than 1, the function will return a range of count values, one for each of the last count rows of the current column segment. In this form, the function can be used as an argument to any of the special range functions. Range functions |
|
If the table is one-dimensional or if the qualifier TOTAL is used as argument, the current column segment is always equal to the entire column. |
Limitations:
Recursive calls will return
Examples and results:
Example: 1
In the screenshot of the table shown in this example, the table visualization is created from the dimension
The column
The table also shows more complex measures: one created from Sum(Sales)+Top(Sum(Sales)) and one labeled
Example: 2
In the screenshots of tables shown in this example, more dimensions have been added to the visualizations:
Please refer to Example: 2 in the
Example: 3 |
Result | ||
---|---|---|---|
The Top function can be used as input to the range functions. For example: RangeAvg (Top(Sum(Sales),1,3)). |
In the arguments for the Top() function, A table with Customer as dimension gives the following results for the |
||
|
Monthnames:
LOAD * INLINE [
Month, Monthnumber
Jan, 1
Feb, 2
Mar, 3
Apr, 4
May, 5
Jun, 6
Jul, 7
Aug, 8
Sep, 9
Oct, 10
Nov, 11
Dec, 12
];
Sales2013:
crosstable (Month, Sales) LOAD * inline [
Customer|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec
Astrida|46|60|70|13|78|20|45|65|78|12|78|22
Betacab|65|56|22|79|12|56|45|24|32|78|55|15
Canutility|77|68|34|91|24|68|57|36|44|90|67|27
Divadip|57|36|44|90|67|27|57|68|47|90|80|94
] (delimiter is '|');
To get the months to sort in the correct order, when you create your visualizations, go to the Sorting section of the properties panel, select Month and mark the checkbox Sort by expression. In the expression box write Monthnumber.