System data metric functions¶
This topic is a reference for the system data metric functions (DMFs) that Snowflake provides to all accounts. DMFs are the building block of data quality checks.
About system DMFs¶
Snowflake provides more than 300 system DMFs in the CORE schema of the shared SNOWFLAKE database. System DMFs are maintained by Snowflake; you cannot change the name or functionality of any system DMF.
Each system DMF enables you to measure a different data quality attribute. You can assign more than one system DMF to a table or view to allow for a more comprehensive data quality measurement to address your governance and compliance needs.
The Statistics DMFs return a measurement rather than a pass or fail signal. You define the expectation that determines whether a given value indicates a problem. The Outliers DMFs apply a built-in threshold, such as Tukey fences or a Z-score cutoff, and return the number or percentage of values that fall outside it. The Outliers DMFs return 0 when the column has fewer than 100 non-NULL, non-NaN values.
The Machine Learning DMFs compare a column of predicted values with a column of actual values, for example, to monitor the output of a machine learning model. Specify the predicted column first when you associate one of these DMFs with a table or view.
Many count and percentage DMFs measure undesirable values, so lower values are better. Other DMFs, such as NOT_NULL_COUNT, measure
values that meet an expectation. The ROWS_IN_PAST DMFs in the Volume category count values in a trailing window that ends at the
scheduled evaluation time; a value of 0 means that no data arrived.
System DMFs¶
Snowflake supports more than 300 system DMFs to measure common metrics without having to define them:
| Category | System DMF | Description |
|---|---|---|
| Completeness | ALL_SPACE_COUNT | Determine how many non-NULL values in a string column are not empty but contain only whitespace. |
| ALL_SPACE_PERCENT | Determine what percentage of values in a string column are not empty but contain only whitespace. | |
| BLANK_COUNT | Determine how many blank values are in a column. | |
| BLANK_PERCENT | Determine what percentage of a column’s values are blank. | |
| EMPTY_STRING_COUNT | Determine how many empty strings are in a column. | |
| EMPTY_STRING_PERCENT | Determine what percentage of a column’s values are empty strings. | |
| NOT_NULL_COUNT | Determine how many non-NULL values are in a column. | |
| NOT_NULL_PERCENT | Determine what percentage of a column’s values are not NULL. | |
| NULL_COUNT | Determine how many NULL values are in a column. | |
| NULL_KEYWORD_COUNT | Determine how many non-NULL values in a string column are a text placeholder for a missing value. | |
| NULL_KEYWORD_PERCENT | Determine what percentage of values in a string column are a text placeholder for a missing value. | |
| NULL_PERCENT | Determine what percentage of a column’s values are NULL. | |
| Consistency | CASE_FORMAT_VIOLATION_COUNT | Determine how many non-NULL values in a string column have inconsistent casing (not all-uppercase, all-lowercase, or title-case). |
| CASE_FORMAT_VIOLATION_PERCENT | Determine what percentage of values in a string column have inconsistent casing. | |
| CONTAINS_SPACES_COUNT | Determine how many non-NULL values in a string column contain a space, tab, or no-break space. | |
| CONTAINS_SPACES_PERCENT | Determine what percentage of values in a string column contain a space, tab, or no-break space. | |
| SPECIAL_CHARACTER_COUNT | Determine how many non-NULL values in a string column contain characters outside the alphanumeric range. | |
| SPECIAL_CHARACTER_PERCENT | Determine what percentage of values in a string column contain characters outside the alphanumeric range. | |
| UNTRIMMED_STRING_COUNT | Determine how many non-NULL values in a string column have leading or trailing spaces. | |
| UNTRIMMED_STRING_PERCENT | Determine what percentage of values in a string column have leading or trailing spaces. | |
| Freshness | FRESHNESS | Determine the freshness of a table’s data based on a timestamp column or the most recent DML operation. |
| SECONDS_SINCE_ROW_COUNT_CHANGE | Determine how many seconds have passed since a DML operation last changed the number of rows in a table. | |
| SOURCE_TARGET_LAG | Determine how far, in seconds, the latest timestamp in a target table trails the latest timestamp in a source table. | |
| Machine Learning | ACCURACY | Determine what percentage of predicted values in a column are equal to the actual values in another column. |
| MAE | Determine the mean absolute error between a column of predicted values and a column of actual values. | |
| MAPE | Determine the mean absolute percentage error between a column of predicted values and a column of actual values. | |
| MEAN_ERROR | Determine whether a column of predicted values is, on average, higher or lower than a column of actual values. | |
| R_SQUARED | Determine the coefficient of determination (R²) of a column of predicted values against a column of actual values. | |
| RMSE | Determine the root mean squared error between a column of predicted values and a column of actual values. | |
| Outliers | EXTREME_OUTLIER_COUNT | Determine how many non-NULL values in a numeric column fall outside the extreme asymmetric Tukey fences for the column. |
| EXTREME_OUTLIER_IQR_COUNT | Determine how many non-NULL values in a numeric column fall outside the extreme Tukey fences (3 times the interquartile range). | |
| EXTREME_OUTLIER_IQR_PERCENT | Determine what percentage of values in a numeric column fall outside the extreme Tukey fences (3 times the interquartile range). | |
| EXTREME_OUTLIER_PERCENT | Determine what percentage of values in a numeric column fall outside the extreme asymmetric Tukey fences for the column. | |
| EXTREME_OUTLIER_ZSCORE_COUNT | Determine how many non-NULL values in a numeric column have an absolute Z-score greater than 4.5. | |
| EXTREME_OUTLIER_ZSCORE_PERCENT | Determine what percentage of values in a numeric column have an absolute Z-score greater than 4.5. | |
| OUTLIER_COUNT | Determine how many non-NULL values in a numeric column fall outside the asymmetric Tukey fences for the column. | |
| OUTLIER_IQR_COUNT | Determine how many non-NULL values in a numeric column fall outside the standard Tukey fences (1.5 times the interquartile range). | |
| OUTLIER_IQR_PERCENT | Determine what percentage of values in a numeric column fall outside the standard Tukey fences (1.5 times the interquartile range). | |
| OUTLIER_PERCENT | Determine what percentage of values in a numeric column fall outside the asymmetric Tukey fences for the column. | |
| OUTLIER_ZSCORE_COUNT | Determine how many non-NULL values in a numeric column have an absolute Z-score greater than 3. | |
| OUTLIER_ZSCORE_PERCENT | Determine what percentage of values in a numeric column have an absolute Z-score greater than 3. | |
| Schema | SCHEMA_CHANGE_ADD_COUNT | Count columns added between consecutive evaluations. |
| SCHEMA_CHANGE_COUNT | Count schema changes (column add, drop, rename, or type change) detected between consecutive evaluations. | |
| SCHEMA_CHANGE_DROP_COUNT | Count columns dropped between consecutive evaluations. | |
| SCHEMA_CHANGE_TYPE_COUNT | Count columns whose data type changed between consecutive evaluations. | |
| Statistics | APPROX_QUANTILE_20 | Determine the approximate 20th percentile value for a numeric column. |
| APPROX_QUANTILE_25 | Determine the approximate 25th percentile value for a numeric column. | |
| APPROX_QUANTILE_40 | Determine the approximate 40th percentile value for a numeric column. | |
| APPROX_QUANTILE_50 | Determine the approximate 50th percentile (median) value for a numeric column. | |
| APPROX_QUANTILE_60 | Determine the approximate 60th percentile value for a numeric column. | |
| APPROX_QUANTILE_80 | Determine the approximate 80th percentile value for a numeric column. | |
| APPROX_QUANTILE_95 | Determine the approximate 95th percentile value for a numeric column. | |
| APPROX_QUANTILE_99 | Determine the approximate 99th percentile value for a numeric column. | |
| AVG | Determine the average value of a column. | |
| FALSE_COUNT | Determine how many non-NULL values in a Boolean column are FALSE. | |
| FALSE_PERCENT | Determine what percentage of values in a Boolean column are FALSE. | |
| GEOMETRIC_MEAN | Determine the geometric mean of the positive values in a numeric column. | |
| HARMONIC_MEAN | Determine the harmonic mean of the nonzero values in a numeric column. | |
| KURTOSIS | Determine the sample excess kurtosis of the values in a numeric column. | |
| MAX | Determine the maximum value of a column. | |
| MEDIAN | Determine the exact median value for a numeric column. | |
| MIN | Determine the minimum value of a column. | |
| NEGATIVE_COUNT | Determine how many non-NULL values in a numeric column are negative. | |
| NEGATIVE_PERCENT | Determine what percentage of values in a numeric column are negative. | |
| SKEW | Determine the sample skewness of the values in a numeric column. | |
| STDDEV | Determine the standard deviation value for a column. | |
| STRING_LENGTH_AVG | Determine the average string length of non-NULL values for a string column. | |
| STRING_LENGTH_MAX | Determine the maximum string length of non-NULL values for a string column. | |
| STRING_LENGTH_MIN | Determine the minimum string length of non-NULL values for a string column. | |
| STRING_LENGTH_STDDEV | Determine the sample standard deviation of the string length of non-NULL values for a string column. | |
| SUM | Determine the sum of the values in a numeric column. | |
| TRUE_COUNT | Determine how many non-NULL values in a Boolean column are TRUE. | |
| TRUE_PERCENT | Determine what percentage of values in a Boolean column are TRUE. | |
| VARIANCE | Determine the variance value for a numeric column. | |
| ZERO_COUNT | Determine how many non-NULL values in a numeric column are equal to zero. | |
| ZERO_PERCENT | Determine what percentage of values in a numeric column are equal to zero. | |
| Uniqueness | DUPLICATE_COUNT | Determine how many distinct values, including NULL, occur more than once in a column. |
| DUPLICATE_PERCENT | Determine what percentage of non-NULL rows have a value that occurs more than once. | |
| UNIQUE_COUNT | Determine the number of distinct non-NULL values in a column. | |
| UNIQUE_PERCENT | Determine what percentage of non-NULL rows have a value that occurs exactly once. | |
| Validity | ACCEPTED_VALUES | Determine how many values in a column don’t match a Boolean expression. |
| ACCEPTED_VALUES_PERCENT | Determine what percentage of values in a column don’t match a Boolean expression. | |
| FUTURE_TIMESTAMP_COUNT | Determine how many non-NULL values in a date/timestamp column are in the future relative to the scheduled evaluation time. | |
| FUTURE_TIMESTAMP_PERCENT | Determine what percentage of values in a date/timestamp column are in the future relative to the scheduled evaluation time. | |
| INVALID_CA_POSTAL_CODE_COUNT | Determine how many non-NULL values in a string column are not a valid Canadian postal code. | |
| INVALID_CA_POSTAL_CODE_PERCENT | Determine what percentage of values in a string column are not a valid Canadian postal code. | |
| INVALID_CA_SIN_COUNT | Determine how many non-NULL values in a string column are not a valid Canadian Social Insurance Number. | |
| INVALID_CA_SIN_PERCENT | Determine what percentage of values in a string column are not a valid Canadian Social Insurance Number. | |
| INVALID_CH_OASI_COUNT | Determine how many non-NULL values in a string column are not a valid Swiss OASI number. | |
| INVALID_CH_OASI_PERCENT | Determine what percentage of values in a string column are not a valid Swiss OASI number. | |
| INVALID_CUSIP_COUNT | Determine how many non-NULL values in a string column are not a valid CUSIP. | |
| INVALID_CUSIP_PERCENT | Determine what percentage of values in a string column are not a valid CUSIP. | |
| INVALID_DE_POSTAL_CODE_COUNT | Determine how many non-NULL values in a string column are not a valid German postal code. | |
| INVALID_DE_POSTAL_CODE_PERCENT | Determine what percentage of values in a string column are not a valid German postal code. | |
| INVALID_DE_TAX_ID_COUNT | Determine how many non-NULL values in a string column are not a valid German tax identification number. | |
| INVALID_DE_TAX_ID_PERCENT | Determine what percentage of values in a string column are not a valid German tax identification number. | |
| INVALID_EMAIL_COUNT | Determine how many non-NULL values in a string column are not a valid email address. | |
| INVALID_EMAIL_PERCENT | Determine what percentage of values in a string column are not a valid email address. | |
| INVALID_ES_DNI_COUNT | Determine how many non-NULL values in a string column are not a valid Spanish DNI number. | |
| INVALID_ES_DNI_PERCENT | Determine what percentage of values in a string column are not a valid Spanish DNI number. | |
| INVALID_FIGI_COUNT | Determine how many non-NULL values in a string column are not a valid FIGI. | |
| INVALID_FIGI_PERCENT | Determine what percentage of values in a string column are not a valid FIGI. | |
| INVALID_FR_INSEE_CODE_COUNT | Determine how many non-NULL values in a string column are not a valid French INSEE commune code. | |
| INVALID_FR_INSEE_CODE_PERCENT | Determine what percentage of values in a string column are not a valid French INSEE commune code. | |
| INVALID_FR_POSTAL_CODE_COUNT | Determine how many non-NULL values in a string column are not a valid French postal code. | |
| INVALID_FR_POSTAL_CODE_PERCENT | Determine what percentage of values in a string column are not a valid French postal code. | |
| INVALID_INTEGER_COUNT | Determine how many non-NULL values in a string column are not an integer. | |
| INVALID_INTEGER_PERCENT | Determine what percentage of values in a string column are not an integer. | |
| INVALID_ISIN_COUNT | Determine how many non-NULL values in a string column are not a valid ISIN. | |
| INVALID_ISIN_PERCENT | Determine what percentage of values in a string column are not a valid ISIN. | |
| INVALID_ISO8601_FORMAT_COUNT | Determine how many non-NULL values in a string column are not in ISO 8601 layout. | |
| INVALID_ISO8601_FORMAT_PERCENT | Determine what percentage of values in a string column are not in ISO 8601 layout. | |
| INVALID_IT_FISCAL_CODE_COUNT | Determine how many non-NULL values in a string column are not a valid Italian fiscal code. | |
| INVALID_IT_FISCAL_CODE_PERCENT | Determine what percentage of values in a string column are not a valid Italian fiscal code. | |
| INVALID_JSON_COUNT | Determine how many non-NULL values in a string column are not valid JSON. | |
| INVALID_JSON_PERCENT | Determine what percentage of values in a string column are not valid JSON. | |
| INVALID_LATITUDE_COUNT | Determine how many non-NULL values in a numeric column are outside the valid latitude range (-90 to 90). | |
| INVALID_LATITUDE_PERCENT | Determine what percentage of values in a numeric column are outside the valid latitude range (-90 to 90). | |
| INVALID_LEI_COUNT | Determine how many non-NULL values in a string column are not a valid LEI. | |
| INVALID_LEI_PERCENT | Determine what percentage of values in a string column are not a valid LEI. | |
| INVALID_LONGITUDE_COUNT | Determine how many non-NULL values in a numeric column are outside the valid longitude range (-180 to 180). | |
| INVALID_LONGITUDE_PERCENT | Determine what percentage of values in a numeric column are outside the valid longitude range (-180 to 180). | |
| INVALID_NL_BSN_COUNT | Determine how many non-NULL values in a string column are not a valid Dutch citizen service number. | |
| INVALID_NL_BSN_PERCENT | Determine what percentage of values in a string column are not a valid Dutch citizen service number. | |
| INVALID_NUMERIC_TYPE_CAST_COUNT | Determine how many non-NULL values in a string column cannot be parsed as numeric. | |
| INVALID_NUMERIC_TYPE_CAST_PERCENT | Determine what percentage of values in a string column cannot be parsed as numeric. | |
| INVALID_PERCENTAGE_RANGE_COUNT | Determine how many non-NULL values in a numeric column are outside the range 0 to 100. | |
| INVALID_PERCENTAGE_RANGE_PERCENT | Determine what percentage of values in a numeric column are outside the range 0 to 100. | |
| INVALID_PERM_ID_COUNT | Determine how many non-NULL values in a string column are not a valid PermID. | |
| INVALID_PERM_ID_PERCENT | Determine what percentage of values in a string column are not a valid PermID. | |
| INVALID_PL_PESEL_COUNT | Determine how many non-NULL values in a string column are not a valid Polish PESEL number. | |
| INVALID_PL_PESEL_PERCENT | Determine what percentage of values in a string column are not a valid Polish PESEL number. | |
| INVALID_PROBABILITY_RANGE_COUNT | Determine how many non-NULL values in a numeric column are outside the range 0 to 1. | |
| INVALID_PROBABILITY_RANGE_PERCENT | Determine what percentage of values in a numeric column are outside the range 0 to 1. | |
| INVALID_SEDOL_COUNT | Determine how many non-NULL values in a string column are not a valid SEDOL. | |
| INVALID_SEDOL_PERCENT | Determine what percentage of values in a string column are not a valid SEDOL. | |
| INVALID_TIMESTAMP_STRING_COUNT | Determine how many non-NULL values in a string column can’t be parsed as a timestamp or date. | |
| INVALID_TIMESTAMP_STRING_PERCENT | Determine what percentage of values in a string column can’t be parsed as a timestamp or date. | |
| INVALID_TR_ID_NO_COUNT | Determine how many non-NULL values in a string column are not a valid Turkish national identification number. | |
| INVALID_TR_ID_NO_PERCENT | Determine what percentage of values in a string column are not a valid Turkish national identification number. | |
| INVALID_UK_NINO_COUNT | Determine how many non-NULL values in a string column are not a valid UK National Insurance number. | |
| INVALID_UK_NINO_PERCENT | Determine what percentage of values in a string column are not a valid UK National Insurance number. | |
| INVALID_UK_POSTAL_CODE_COUNT | Determine how many non-NULL values in a string column are not a valid UK postcode. | |
| INVALID_UK_POSTAL_CODE_PERCENT | Determine what percentage of values in a string column are not a valid UK postcode. | |
| INVALID_USA_PHONE_COUNT | Determine how many non-NULL values in a string column are not a valid U.S. phone number. | |
| INVALID_USA_PHONE_PERCENT | Determine what percentage of values in a string column are not a valid U.S. phone number. | |
| INVALID_USA_STATE_CODE_COUNT | Determine how many non-NULL values in a string column are not a valid U.S. state code. | |
| INVALID_USA_STATE_CODE_PERCENT | Determine what percentage of values in a string column are not a valid U.S. state code. | |
| INVALID_USA_ZIP_CODE_COUNT | Determine how many non-NULL values in a string column are not a valid U.S. ZIP Code. | |
| INVALID_USA_ZIP_CODE_PERCENT | Determine what percentage of values in a string column are not a valid U.S. ZIP Code. | |
| INVALID_UUID_COUNT | Determine how many non-NULL values in a string column are not a valid UUID. | |
| INVALID_UUID_PERCENT | Determine what percentage of values in a string column are not a valid UUID. | |
| NAN_COUNT | Determine how many non-NULL values in a numeric or string column are NaN. | |
| NAN_PERCENT | Determine what percentage of values in a numeric or string column are NaN. | |
| NOT_FRIDAY_COUNT | Determine how many non-NULL values in a date/timestamp column don’t fall on a Friday. | |
| NOT_FRIDAY_PERCENT | Determine what percentage of values in a date/timestamp column don’t fall on a Friday. | |
| NOT_IN_FUTURE_COUNT | Determine how many non-NULL values in a date/timestamp column are not in the future relative to the scheduled evaluation time. | |
| NOT_IN_FUTURE_PERCENT | Determine what percentage of values in a date/timestamp column are not in the future relative to the scheduled evaluation time. | |
| NOT_MONDAY_COUNT | Determine how many non-NULL values in a date/timestamp column don’t fall on a Monday. | |
| NOT_MONDAY_PERCENT | Determine what percentage of values in a date/timestamp column don’t fall on a Monday. | |
| NOT_SATURDAY_COUNT | Determine how many non-NULL values in a date/timestamp column don’t fall on a Saturday. | |
| NOT_SATURDAY_PERCENT | Determine what percentage of values in a date/timestamp column don’t fall on a Saturday. | |
| NOT_SUNDAY_COUNT | Determine how many non-NULL values in a date/timestamp column don’t fall on a Sunday. | |
| NOT_SUNDAY_PERCENT | Determine what percentage of values in a date/timestamp column don’t fall on a Sunday. | |
| NOT_THURSDAY_COUNT | Determine how many non-NULL values in a date/timestamp column don’t fall on a Thursday. | |
| NOT_THURSDAY_PERCENT | Determine what percentage of values in a date/timestamp column don’t fall on a Thursday. | |
| NOT_TODAY_COUNT | Determine how many non-NULL values in a date/timestamp column aren’t on the date of the scheduled evaluation time. | |
| NOT_TODAY_PERCENT | Determine what percentage of values in a date/timestamp column aren’t on the date of the scheduled evaluation time. | |
| NOT_TUESDAY_COUNT | Determine how many non-NULL values in a date/timestamp column don’t fall on a Tuesday. | |
| NOT_TUESDAY_PERCENT | Determine what percentage of values in a date/timestamp column don’t fall on a Tuesday. | |
| NOT_WEDNESDAY_COUNT | Determine how many non-NULL values in a date/timestamp column don’t fall on a Wednesday. | |
| NOT_WEDNESDAY_PERCENT | Determine what percentage of values in a date/timestamp column don’t fall on a Wednesday. | |
| NOT_WEEKDAY_COUNT | Determine how many non-NULL values in a date/timestamp column fall on a Saturday or a Sunday. | |
| NOT_WEEKDAY_PERCENT | Determine what percentage of values in a date/timestamp column fall on a Saturday or a Sunday. | |
| NOT_YESTERDAY_COUNT | Determine how many non-NULL values in a date/timestamp column aren’t on the day before the date of the scheduled evaluation time. | |
| NOT_YESTERDAY_PERCENT | Determine what percentage of values in a date/timestamp column aren’t on the day before the date of the scheduled evaluation time. | |
| REFERENTIAL_INTEGRITY_COUNT | Determine how many source rows have non-NULL column values that don’t match a row in the referenced table. | |
| UNIX_ZERO_COUNT | Determine how many non-NULL values in a date/timestamp column are equal to the Unix epoch (1970-01-01). | |
| UNIX_ZERO_PERCENT | Determine what percentage of values in a date/timestamp column are equal to the Unix epoch (1970-01-01). | |
| Volume | ROW_COUNT | Determine how many records are in the table or view. |
| ROW_COUNT_DIFFERENCE | Determine how many more or fewer rows the table has than a reference table. | |
| ROWS_IN_PAST_DAY_COUNT | Determine how many non-NULL values in a timestamp column fall in the 24 hours before the scheduled evaluation time. | |
| ROWS_IN_PAST_DAY_PERCENT | Determine what percentage of values in a timestamp column fall in the 24 hours before the scheduled evaluation time. | |
| ROWS_IN_PAST_HOUR_COUNT | Determine how many non-NULL values in a timestamp column fall in the hour before the scheduled evaluation time. | |
| ROWS_IN_PAST_HOUR_PERCENT | Determine what percentage of values in a timestamp column fall in the hour before the scheduled evaluation time. | |
| ROWS_IN_PAST_MONTH_COUNT | Determine how many non-NULL values in a date/timestamp column fall in the 30 days before the scheduled evaluation time. | |
| ROWS_IN_PAST_MONTH_PERCENT | Determine what percentage of values in a date/timestamp column fall in the 30 days before the scheduled evaluation time. | |
| ROWS_IN_PAST_WEEK_COUNT | Determine how many non-NULL values in a date/timestamp column fall in the 7 days before the scheduled evaluation time. | |
| ROWS_IN_PAST_WEEK_PERCENT | Determine what percentage of values in a date/timestamp column fall in the 7 days before the scheduled evaluation time. | |
| ROWS_IN_PAST_YEAR_COUNT | Determine how many non-NULL values in a date/timestamp column fall in the 365 days before the scheduled evaluation time. | |
| ROWS_IN_PAST_YEAR_PERCENT | Determine what percentage of values in a date/timestamp column fall in the 365 days before the scheduled evaluation time. | |
| TABLE_SIZE_BYTES | Determine the logical size of a table, in bytes. |
Some system DMFs measure closely related conditions:
NULL_COUNTandNOT_NULL_COUNTare complements: together they count every row. The same is true ofNULL_PERCENTandNOT_NULL_PERCENT.BLANK_COUNTcounts values that are empty or contain only spaces, such as''and' '.EMPTY_STRING_COUNTcounts only the empty string''. Neither function countsNULLvalues.FUTURE_TIMESTAMP_COUNTcounts values that are later than the scheduled evaluation time, andNOT_IN_FUTURE_COUNTcounts values that are at or before it. Neither function countsNULLvalues, so together they count every non-NULLvalue.DUPLICATE_PERCENTreturns the percentage of non-NULLrows whose value occurs more than once, andUNIQUE_PERCENTreturns the percentage whose value occurs exactly once. Both excludeNULLvalues, so together they add up to 100 when the column has a non-NULLvalue.ALL_SPACE_COUNTcounts non-empty values that contain only whitespace, including tabs, line breaks, and no-break spaces. UnlikeBLANK_COUNT, it doesn’t count the empty string''.CONTAINS_SPACES_COUNTcounts values that contain a space, tab, or no-break space anywhere, andUNTRIMMED_STRING_COUNTcounts only values with a leading or trailing space. Tabs and no-break spaces at the start or end of a value aren’t counted byUNTRIMMED_STRING_COUNT.INVALID_ISO8601_FORMAT_COUNTchecks only the layout of a value, andINVALID_TIMESTAMP_STRING_COUNTchecks whether the value can be parsed as a timestamp. For example,2026-13-45has a valid ISO 8601 layout but can’t be parsed.INVALID_INTEGER_COUNTcounts values that aren’t written as an integer, andINVALID_NUMERIC_TYPE_CAST_COUNTcounts values that can’t be cast to a number. For example,3.7is counted byINVALID_INTEGER_COUNTbut not byINVALID_NUMERIC_TYPE_CAST_COUNT.TRUE_PERCENT,FALSE_PERCENT, andNULL_PERCENTadd up to 100 for a Boolean column that has at least one row.SCHEMA_CHANGE_ADD_COUNT,SCHEMA_CHANGE_DROP_COUNT, andSCHEMA_CHANGE_TYPE_COUNTeach count one kind of change thatSCHEMA_CHANGE_COUNTalso counts. Renamed columns are counted only bySCHEMA_CHANGE_COUNT.FRESHNESSmeasures how long ago a single table was last updated, andSOURCE_TARGET_LAGmeasures how far the latest timestamp in a target table trails the latest timestamp in a source table.FRESHNESSwithout a column measures the time since any DML operation on a table, andSECONDS_SINCE_ROW_COUNT_CHANGEmeasures the time since a DML operation last changed the number of rows in the table. For example, an UPDATE resetsFRESHNESSbut notSECONDS_SINCE_ROW_COUNT_CHANGE.ROW_COUNTcounts the rows in a single table, andROW_COUNT_DIFFERENCEreturns how many more or fewer rows the table has than a reference table.ACCEPTED_VALUEScounts the records that don’t match a Boolean expression, andACCEPTED_VALUES_PERCENTreturns the percentage of records that don’t match it.AVGreturns the average of a column at one evaluation.AVG_CHANGE_LAST_PERIODcomputes the average for the last period and for each equally long tile of the baseline, and returns how much the average of the last period differs from the average of the tiles. Most other_CHANGEperiod-comparison DMFs work the same way for their measurement.NEW_VALUE_COUNT,MISSING_VALUE_COUNT,PSI,JS_DIVERGENCE, andKS_TESThave no base metric and compare the current window with the whole baseline.
Period-comparison system DMFs¶
The period-comparison system DMFs compare the data in the most recent periods of a table’s data metric schedule
with a baseline of equally long windows before them that covers at least 14 days. Use them to detect changes over time, such as a drop in the number
of rows loaded (ROW_COUNT_CHANGE_PERCENT), a rise in NULL values (NULL_COUNT_CHANGE), or a shift in the distribution of a column (PSI).
Each metric comes in four functions that differ in the length of the window that they compare. The function name ends with the window:
_LAST_PERIOD: the last period._LAST_TWO_PERIODS: the last 2 periods._LAST_FOUR_PERIODS: the last 4 periods._LAST_EIGHT_PERIODS: the last 8 periods.
For example, NULL_PERCENT_CHANGE_LAST_TWO_PERIODS returns how much the percentage of NULL values in the last 2 periods differs from the baseline.
A period is one interval of the table’s DATA_METRIC_SCHEDULE. All functions except
ROW_COUNT_CHANGE and ROW_COUNT_CHANGE_PERCENT take a value column and a time column, for example ON (order_total, order_ts). Those two
take only the time column. For the rules that all these functions share, such as how the baseline is built, what happens when there isn’t enough
history, and how to choose a schedule, see the “How the comparison works” section of any of these functions, for example
AVG_CHANGE_LAST_PERIOD.
These functions have restrictions that the other system DMFs don’t have:
- The table’s schedule must be a cron expression or an interval, not
TRIGGER_ON_CHANGES. - The functions that count rows or values or sum values, and
NEW_VALUE_COUNTandMISSING_VALUE_COUNT, need a schedule that fires at evenly spaced times of day. - You can’t use them with
FILTERorWITHIN GROUP, evaluate them ad hoc, call them directly, or use them withSYSTEM$DATA_METRIC_SCAN.
A _CHANGE_PERCENT function returns NULL when the baseline is 0, and a scheduled evaluation records NULL as 0. To detect a change from 0,
such as NULL values appearing in a column that had none, use the matching _CHANGE function.
Completeness¶
NULL_COUNT_CHANGE: Determine the change in the number ofNULLvalues in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)NULL_COUNT_CHANGE_PERCENT: Determine the percentage change of the number ofNULLvalues in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)NULL_PERCENT_CHANGE: Determine the change in the percentage of values in the column that areNULLcompared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)NULL_PERCENT_CHANGE_PERCENT: Determine the percentage change of the percentage of values in the column that areNULLcompared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)
Statistics¶
AVG_CHANGE: Determine the change in the average of the values in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)AVG_CHANGE_PERCENT: Determine the percentage change of the average of the values in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)JS_DIVERGENCE: Determine the Jensen-Shannon divergence of a column’s values against the baseline. (1 period, 2 periods, 4 periods, 8 periods)KS_TEST: Determine the Kolmogorov-Smirnov D statistic of a column’s values against the baseline. (1 period, 2 periods, 4 periods, 8 periods)MAX_CHANGE: Determine the change in the maximum of the values in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)MAX_CHANGE_PERCENT: Determine the percentage change of the maximum of the values in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)MEDIAN_CHANGE: Determine the change in the median of the values in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)MEDIAN_CHANGE_PERCENT: Determine the percentage change of the median of the values in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)MIN_CHANGE: Determine the change in the minimum of the values in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)MIN_CHANGE_PERCENT: Determine the percentage change of the minimum of the values in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)MISSING_VALUE_COUNT: Determine how many distinct non-NULLvalues in the baseline don’t appear in the current window. (1 period, 2 periods, 4 periods, 8 periods)NEGATIVE_COUNT_CHANGE: Determine the change in the number of negative values in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)NEGATIVE_COUNT_CHANGE_PERCENT: Determine the percentage change of the number of negative values in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)NEGATIVE_PERCENT_CHANGE: Determine the change in the percentage of values in the column that are negative compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)NEGATIVE_PERCENT_CHANGE_PERCENT: Determine the percentage change of the percentage of values in the column that are negative compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)NEW_VALUE_COUNT: Determine how many distinct non-NULLvalues in the current window don’t appear in the baseline. (1 period, 2 periods, 4 periods, 8 periods)PSI: Determine the population stability index (PSI) of a column’s values against the baseline. (1 period, 2 periods, 4 periods, 8 periods)STDDEV_CHANGE: Determine the change in the sample standard deviation of the values in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)STDDEV_CHANGE_PERCENT: Determine the percentage change of the sample standard deviation of the values in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)SUM_CHANGE: Determine the change in the sum of the values in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)SUM_CHANGE_PERCENT: Determine the percentage change of the sum of the values in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)ZERO_COUNT_CHANGE: Determine the change in the number of zero values in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)ZERO_COUNT_CHANGE_PERCENT: Determine the percentage change of the number of zero values in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)ZERO_PERCENT_CHANGE: Determine the change in the percentage of values in the column that are zero compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)ZERO_PERCENT_CHANGE_PERCENT: Determine the percentage change of the percentage of values in the column that are zero compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)
Uniqueness¶
UNIQUE_COUNT_CHANGE: Determine the change in the number of distinct non-NULLvalues in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)UNIQUE_COUNT_CHANGE_PERCENT: Determine the percentage change of the number of distinct non-NULLvalues in the column compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)
Volume¶
ROW_COUNT_CHANGE: Determine the change in the number of rows in the table compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)ROW_COUNT_CHANGE_PERCENT: Determine the percentage change of the number of rows in the table compared with the baseline. (1 period, 2 periods, 4 periods, 8 periods)
Related functions¶
DATA_METRIC_SCHEDULED_TIME isn’t a metric and you can’t associate it with a table or view. Call it in the body of a custom DMF to retrieve the scheduled evaluation time, for example to define a custom freshness metric.