Unknown Values in Spectre

Prior to version 7.0(14), unknown was called error. It represented only errors, such as a bad date format, and displayed as <error> in Dive windows. Starting with Spectre 7.0(14), unknown also stands for cases that are not errors but nevertheless cannot be represented by a normal value, such as division by zero. Usually, unknown displays as a blank cell.

There are many other differences, which this topic describes in detail, but the biggest changes are:

  • unknown is no longer just for errors
  • unknown displays as blank in summary columns

Unknown indicates a value that cannot be computed. Here are some ways to get an unknown value in Spectre:

  • Uncomputable numeric operations.

    For example, `1/0`, `log(-1)`, `arcsin(10)`.

  • Uncomputable date or period operations.

    For example, `day(null)`.

  • Format or parse errors.

    For example, `parse_integer("badnum")`, `date("2015 Jan", "M-D-YYYY")`.

  • Invalid arguments.

    For example, `period("badcalendarname", "2015 Jan")`, `extract(date("2015/01/01"), "badinterval")`.

With very few exceptions, every expression that encounters unknown returns unknown. It is never treated as a normal value because it is impossible to determine which normal value applies.

You can check for unknown with the is_unknown() function and use the catch() function to substitute alternative values for unknown.

Displaying and Diving on Null and Unknown

  • In summary columns, that is the non-dimension columns, null and unknown both display as blank values.
  • In dimension columns, null is the blank value and unknown displays as <unknown>.

See also: