Welcome to the Alteryx Knowledge Base

Metric-based Data Quality Rules
user

Created/Edited - 12/6/2024 by Abe Wang | Alteryx

How To
Create a metric-based Data Quality Rule.
Environment

Example Scenario

You can create a data quality rule using custom metrics to assess the data quality.
You can use the calculated metric type (derived metrics) as a data quality input type and create a metric-based data quality rule. For example, you can create a constraint that the sales quantity should be within a specific range.
Metric-based rules are supported only for some metric types. For more information on the rule types that support metrics, see Data Quality Rules Reference.
Metric input types are supported for the following rules:
  • In Range
  • Greater Than
  • Less Than
  • Equals
  • Not Equals
  • In Set
  • Not In Set
Metric nameDescription
AverageThe average column value.
Count DistinctThe number of unique column values.
MaximumThe maximum column value.
MinimumThe minimum column value.
SumThe sum of column values.
Standard DeviationThe sample standard deviation of column values.
VarianceThe sample variance of column values.
CountThe number of rows.
CorrelationThe Pearson correlation coefficient between two columns.
Z-ScoreThe distance from the mean, in units of standard deviations.
Procedure
1.Click on the Data Quality Rule icons on the top right corner of the Transformer.
 

1.png
 

2. Click on Add rule
 

2.png
 

3. In the list of available Data Quality Rule options, look for Column Values
 

3.png

 

4. Select an option -

For example, to build a data quality rule where the average Price has to be greater than 5, select Greater Than.
 

In the Rule Builder, select the Input Type as Average, the column Price and Minimum Value of 5.
 

4.png


5. Use Group By to group the data per certain categories.
 

5.png


6. Click on Add to add this as a Data Quality Rule
 

5.png
 

The metric-based data quality rule is added.

 

The new rule is displayed in the Data Quality Rules panel. In the data quality bar for the rule, the green bar indicates the row values that have passed the rule, and the red bar indicates the row values that failed.

  • Hover over either color to see the row counts and percentage.
  • Select either color to highlight the indicated rows in the data grid.

Additional options are available in the context menu for the rule. For more information, see Data Quality Rules Panel.

 
Additional Information

To learn more, read the following detailed documentation guides-

Was this article helpful?