Skip to main content Skip to complementary content


GetSelectedCount() finds the number of selected (green) values in a field.


GetSelectedCount (field_name [, include_excluded])

Return data type: integer


  • field_name: The field containing the range of data to be measured.
  • include_excluded: If set to True(), the count will include selected values, which are currently excluded by selections in other fields. If False or omitted, these values will not be included.
  • state_name: The name of an alternate state. If specified, the counted value for the field in the alternate state is returned. If no alternate state is provided, the default state is used.


The following example uses three fields loaded to different list boxes, one for First name name, one for Initials and one for Has cellphone.

Example 1: John selected in First name

GetSelectedCount ([First name])

returns 1 as one value is selected in First name.

Example 2: John selected in First name

GetSelectedCount ([Initials])

returns 0 as no values are selected in Initials.

Example 3: no selections in First name, all values selected in Initials, and Yes selected in Has cellphone

GetSelectedCount ([Initials], True())

returns 6. Although selections with InitialsMC and PD have Has cellphone set to No, the result is still 6, because the argument include_excluded is set to True().

Data used in example:


LOAD * inline [

"First name"|"Last name"|Initials|"Has cellphone"



Mark|Carr|MC |No



Peter|Franc|PF|Yes ] (delimiter is '|');

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: