Skip to main content

FieldValueCount

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

Syntax:  

FieldValueCount(field_name)

Return data type: integer

Arguments:  

  • 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.

Examples:  

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:

FieldValueCount('Initials')

6 as Initials only has distinct values.

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

John1:

Load FieldValueCount('First name') as MyFieldCount1

Resident Names;

MyFieldCount1=5, because 'John' appears twice.

Script function with Names:

John1:

Load FieldValueCount('Initials') as MyInitialsCount1

Resident Names;

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

Data used in example:

Data used in example:

Names:

LOAD * inline [

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

John|Anderson|JA|Yes

Sue|Brown|SB|Yes

Mark|Carr|MC |No

Peter|Devonshire|PD|No

Jane|Elliot|JE|Yes

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

 

FieldCount1:

Load FieldValueCount('First name') as MyFieldCount1

Resident Names;

 

FieldCount2:

Load FieldValueCount('Initials') as MyInitialsCount1

Resident Names;

Join the Analytics Modernization Program

Modernize by leveraging your QlikView investment to begin using Qlik Sense on the Cloud.

Want to know more?
Remove banner from view