Newer Version Available

This content describes an older version of this product. View Latest

Nulls and Nulls in Measures

In most contexts, SAQL allows the use of null anywhere a constant string or number would appear. SAQL also supports use of null measures.

Using Nulls In SAQL

You can specify a null constant almost anywhere a constant string or number can appear in SAQL, with the following exceptions and clarifications.

Typing

null is not typed. It is inferred from context. For example, null + 4 is a number. A SAQL syntax error will be generated when a type cannot be infered.

Filters

When a filter expression evaluates to null, the row is filtered out.

  • Lists

    foo in [null, "bar"] is handled like foo == null or foo == "bar".

  • Ranges

    filter q by dim in [null.."myvalue"] is handled as (dim>=null and dim<=7)

Unsupported

null is not supported in the following contexts:

  • Offset
  • Limit
  • dateRelative
  • dateRange
  • Windowing range
  • Trim (second argument)

Null Values in Measures

Measures in Wave are dataset columns that contain numerical values. Wave supports null values in measures.

If null measure handling is not enabled in your org, it can be enabled by your admin.

Note

Null measure handling lets customers distinguish between null and non-null—for example, the number 0—values in their numerical data. SAQL support for null measures facilitates this customer preference; for example, when using aggregation, comparison, and math functions, and for order by or group by clauses.

When you create or update a dataset, for example through your dataflow or a CSV upload, any blank measure values in your data are replaced with specific values. Wave uses the default values specified in your dataflow or CSV metadata file to replace blank values.

Replacing blank values with zeros can be problematic for a number of reasons. Take the example of data with customer satisfaction scores, where some customers have not responded. Calculated values such as average and minimum are correct in the source data, but when blank values are replaced with zeros when the dataset is created, the resulting calculations are incorrect.

Null measure handling lets you specify defaults using the special "null" value in your dataflows and CSV metadata files. When no default value is specified, Wave replaces blanks with null values.

For more information on null measure handling and how to set it up, see the Data Integration guide.