Top
Top() evaluates an expression at the first (top) row of a column segment in a table. The row for which it is calculated depends on the value of offset, if present, the default being the top row. For charts other than tables, theTop() evaluation is made on the first row of the current column in the chart's straight table equivalent.
Syntax:
Top([TOTAL] expr [ , offset [,count ]])
Return data type: dual
Arguments:
 expr: The expression or field containing the data to be measured.
 offset: Specifying an offset n, greater than 0, moves the evaluation of the expression n rows further up from the current row. Specifying an offset of 0 will evaluate the expression on the current row. Specifying a negative offset number makes the Above function work like the Below function with the corresponding positive offset number.
 count: By specifying a third argument count greater than 1, the function will return a range of count values, one for each of count table rows counting upwards from the original cell. In this form, the function can be used as an argument to any of the special range functions. Range functions
 TOTAL: If the table is onedimensional or if the qualifier TOTAL is used as argument, the current column segment is always equal to the entire column.
Limitations:

Sorting on yvalues in charts or sorting by expression columns in tables is not allowed when this chart function is used in any of the chart's expressions. These sort alternatives are therefore automatically disabled. When you use this chart function in a visualization or table, the sorting of the visualization will revert back to the sorted input to this function.

Recursive calls will return NULL.
Examples and results:
Example 1:
Customer  Sum(Sales)  Top(Sum(Sales))  Sum(Sales) + Top(Sum(Sales))  Top offset 3 

2566  587  3153  3249  
Astrida  587  587  1174  1270 
Betacab  539  587  1126  1222 
Canutility  683  587  1270  1366 
Divadip  757  587  1344  1440 
In the representation of the table chart shown in this example, the table is created from the dimension Customer and the measures: Sum(Sales) and Top(Sum(Sales)).
The column Top(Sum(Sales)) returns 587 for the all rows because this is the value of the top row: Astrida.
The table also shows more complex measures: one created from Sum(Sales)+Top(Sum(Sales)) and one labeled Top offset 3, which is created using the expression Sum(Sales)+Top(Sum(Sales), 3) and has the argument offset set to 3. It adds the Sum(Sales) value for the current row to the value from the third row from the top row, that is, the current row plus the value for Canutility.
Example 2:
In the representations of table charts shown in this example, more dimensions have been added to the charts: Month and Product. For charts with more than one dimension, the results of expressions containing the Above, Below, Top, and Bottom functions depend on the order in which the column dimensions are sorted by QlikView. QlikView evaluates the functions based on the column segments that result from the dimension that is sorted last. The column sort order is controlled under Sort and is not necessarily the order in which the columns appear in a table. (Some rows are not shown, to save space.)
Customer  Product  Month  Sum(Sales)  First value 

2566    
Astrida  AA  Jan  46  46 
Astrida  AA  Feb  60  46 
Astrida  AA  Mar  70  46 
...  ...  ...  ...  ... 
Astrida  AA  Sep  78  46 
Astrida  AA  Oct  12  46 
Astrida  AA  Nov  78  46 
Astrida  AA  Dec  22  46 
Astrida  BB  Jan  46  46 
Customer  Product  Month  Sum(Sales)  First value 

2566    
Astrida  AA  Jan  46  46 
Astrida  BB  Jan  46  46 
Astrida  AA  Feb  60  60 
Astrida  BB  Feb  60  60 
Astrida  AA  Mar  70  70 
Astrida  BB  Mar  70  70 
Astrida  AA  Apr  13  13 
Astrida  BB  Apr  13  13 
Please refer to Example 2 in the Above function for further details.
Example 3:
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, offset is set to 1 and count is set to 3. The function finds the results of the expressionSum(Sales) on the three rows starting with the row below the bottom row in the column segment (because the offset=1), and the two rows below that (where there is a row). These three values are used as input to the RangeAvg() function, which finds the average of the values in the supplied range of numbers.
A table with Customer as dimension gives the following results for the RangeAvg() expression.
Customer  RangeAvg (Top(Sum(Sales),1,3)) 

Astrida  603 
Betacab  603 
Canutility  603 
Divadip  603 
Data used in examples:
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 [
CustomerJanFebMarAprMayJunJulAugSepOctNovDec
Astrida466070137820456578127822
Betacab655622791256452432785515
Canutility776834912468573644906727
Divadip573644906727576847908094
] (delimiter is '');
To get the months to sort in the correct order, when you create your charts, go to the Sort tab of the chart properties, and mark the checkbox Expression under Sort by. In the expression box write Monthnumber.