Skip to main content


FieldValueCount() is an integer function that finds the number of distinct values in a field.



Return data type: integer


  • field_name: Name of the field for which the index is required. For example, the column in a table. Must be given as a string value. This means that the field name must be enclosed by single quotes.
Information noteSorting on y-values 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.


Add the example data below to your document and run it. The following examples use the field: First name from the tableNames.

Examples and results
Example Result

Chart function - in a table containing the dimension First name, add as a measure:

FieldValueCount('First name')

5 as Peter appears twice.

Chart function with First name:


6 as Initials only has distinct values.

Script function - given the table Names is loaded, as in the example data:


Load FieldValueCount('First name') as MyFieldCount1

Resident Names;

MyFieldCount1=5, because 'John' appears twice.

Script function with Names:


Load FieldValueCount('Initials') as MyInitialsCount1

Resident Names;

MyFieldCount1=6, because 'Initials' only has distinct values.

Data used in example:

Data used in example:


LOAD * inline [

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



Mark|Carr|MC |No



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



Load FieldValueCount('First name') as MyFieldCount1

Resident Names;



Load FieldValueCount('Initials') as MyInitialsCount1

Resident Names;

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: