Page tree

Trifacta SaaS



Contents:

   

This example demonstrates how to count the number of values and non-null values within a group.

Functions:

ItemDescription
COUNTA Function Generates the count of non-null rows in a specified column, optionally counted by group. Generated value is of Integer type. 
COUNTDISTINCT Function Generates the count of distinct values in a specified column, optionally counted by group. Generated value is of Integer type. 

Source:

In the following example, the seventh row is an empty string, and the eighth row is a null value.

rowIdVal
r001val1
r002val1
r003val1
r004val2
r005val2
r006val3
r007(empty)
r008(null)

Transformation:

Apply a COUNTA function on the source column:

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula COUNTA(Val)
Parameter: New column name 'fctnCounta'

Apply a COUNTDISTINCT function on the source:

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula COUNTDISTINCT(Val)
Parameter: New column name 'fctnCountdistinct'

Results:

Below, both functions count the number of values in the column, with COUNTDISTINCT counting distinct values only. The empty value for r007 is counted by both functions.

rowIdValfctnCountdistinctfctnCounta
r001val147
r002val147
r003val147
r004val247
r005val247
r006val347
r007(empty)47
r008(null)47

See Also for EXAMPLE - COUNT Functions:

This page has no comments.