Early Access: The content on this website is provided for informational purposes only in connection with pre-General Availability Qlik Products. All content is subject to change and is provided without warranty.
The colors used in the selection bar, and for each selection state, can be modified with a custom theme. If you are working with an app that uses a custom theme, you might notice that your selections do not display with the same colors that are described in this help topic.
Arguments
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.
state_name
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.
Returns the count of excluded values, not including alternative and selected excluded values.
Example: Chart expressions
Example
Result
GetSelectedCount (FirstName)
If no selections are made then 0 is returned. If any selections have been made in the FirstName field then the number of items selected is returned.
GetSelectedCount (FirstName, True())
If no selections are made then 0 is returned. If any selections have been made in the FirstName field then the number of items selected is returned regardless of any subsequent selections in other fields that might reduce the available values in the FirstName field.
Example - GetSelectedCount fundamentals
Overview
Open the Data load editor and add the load script below to a new section.
The load script contains:
A dataset which is loaded into a data table called Example.
Load the data and open a sheet. Create a new filter pane and add these fields as dimensions:
FirstName
Initials
Create two KPI objects, one for each of the following measure expressions:
KPI 1: =GetSelectedCount(FirstName) to return the number of items selected in the FirstName field.
KPI 2: =GetSelectedCount(Initials), to return the number of items selected in the Initials field.
Each KPI returns the number of selected items in each field. With no selections in the filters, both KPIs return the value 0.
Tip noteIn this example the styling of the KPI has been adjusted to use a responsive layout behavior to make it easier to view the output. For more information about changing the chart layout behavior, see Styling the KPI
Click Edit sheet to switch to analysis mode, and then select John in the FirstName filter.
KPI 1 returns the value 1 because there is one item selected in the FirstName filter. KPI 2 still returns 0 because the Initials filter has no selected items.
Example - GetSelectedCount with include_excluded parameter
Overview
This example uses the same dataset as the previous example, but demonstrates the difference in results when the include_excluded parameter is set to True().
Open the Data load editor and add the load script below to a new section.
The load script contains:
A dataset which is loaded into a data table called Example.
Load the data and open a sheet. Create a new filter pane and add these fields as dimensions:
Initials
HasCellPhone
Create two KPI objects, one for each of the following measure expressions:
KPI 1: =GetselectedCount(Initials) to determine the number of values that have been selected in the Initials field.
KPI 2: =GetSelectedCount([Initials], True()) to include the selected values which are currently excluded by selections in other fields.
With no selections in the filter pane, each KPI returns the value 0.
Tip noteIn this example the styling of the KPI has been adjusted to use a responsive layout behavior to make it easier to view the output. For more information about changing the chart layout behavior, see Styling the KPI
Click Edit sheet to switch to analysis mode. Select all values in the Initials filter, and then select Yes in the HasCellphone filter.
When you compare the results of each KPI, you can see how each returns a different value depending on whether the include_excluded parameter is set to True() or not. KPI 2 returns the value 6 because it includes all selected values in the Initials filter, even though the selection in the HasCellphone filter has reduced the available items to 4. KPI 1 returns 4 because it does not count the selected excluded values in Initials.
Selections
Selections are values selected by a user in visualizations in an app used to filter data. When a selection is made, all associated visualizations are updated to reflect the selection. Selections can be saved as bookmarks, and shared with other users.