QlikWorld 2020 Global Conference. Join us to discover how to get the most from your data. Act fast. Register now and save.

GetSelectedCount - chart function

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


GetSelectedCount (field_name [, include_excluded [, state_name]])

Return data type: integer


Arguments Description
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.

The name of an alternate state that has been chosen for the specific visualization. If the state_name argument is used, only the selections associated with the specified state name are taken into account.

For more information, see Using alternate states for comparative analysis.

Examples and results:  

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

Examples Results

Given that John is selected in First name.

GetSelectedCount ([First name])

1 as one value is selected in First name.

Given that John is selected in First name.

GetSelectedCount ([Initials])

0 as no values are selected in Initials.

With no selections in .First name, select all values in Initials and after that select the value Yes in Has cellphone.

GetSelectedCount ([Initials], True())

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 information help you?

Thanks for letting us know. Is there anything you'd like to tell us about this topic?

Can you tell us why it did not help you and how we can improve it?