Skip to main content Skip to complementary content

RangeCount - script and chart function

RangeCount() returns the number of values, both text and numeric, in the expression or field.

Syntax:  

RangeCount(first_expr[, Expression])

Return data type: integer

Arguments:  

The argument of this function may contain inter-record functions which in themselves return a list of values.

  • first_expr: The expression or field containing the data to be counted.
  • Expression: Optional expressions or fields containing additional data to be counted.

Limitations:  

NULL values are not counted.

Examples:  

Examples and results
Example Result
RangeCount (1,2,4)

Returns 3

RangeCount (2,'xyz')

Returns 2
RangeCount (null( )) Returns 0
RangeCount (2,'xyz', null()) Returns 2

Example: (using expression)

RangeCount (Above(MyField,1,3))

Returns the number of values contained in the three results of MyField. By specifying the second and third arguments of the Above() function as 3, it returns the values from the three fields above the current row, where there are sufficient rows, which are taken as input to the RangeSum() function.

Example expression output
MyField RangeCount(Above(MyField,1,3))

10

0
2 1
8 2
18 3
5 3
9 3

Data used in examples:

RangeTab:

LOAD * INLINE [

MyField

10

2

8

18

5

9

] ;

Example: (in table form)

Add the example script to your document and run it. Then add, at least, the fields listed in the results column to a sheet in your document to see the result.

RangeTab3:

LOAD recno() as RangeID, RangeCount(Field1,Field2,Field3) as MyRangeCount INLINE [

Field1, Field2, Field3

10,5,6

2,3,7

8,2,8

18,11,9

5,5,9

9,4,2

];

The resulting table shows the returned values of MyRangeCount for each of the records in the table.

Example output in table form
RangeID MyRangeCount
1 3
2 3
3 3
4 3
5 3
6 3

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!

Join the Analytics Modernization Program

Remove banner from view

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: ampquestions@qlik.com