Quantile
  • 1 Minute to read
  • Dark
    Light
  • PDF

Quantile

  • Dark
    Light
  • PDF

Article summary

General: Quantile

Groups data into a specified number of segments, where each segment contains the same number of records.

Purpose

Use this function to:
  • Group data into relative ranks
  • Create percentiles, quartiles etc

Return Value

PropertyValue
FieldTypeInteger
FieldSizeLow
DataTypeContinuous
DataSizeByte


Example Return Value: 1.....S where S is the number of segments.

Parameters

ParameterJSONDescription
Table“targetTable”: “MyTableName”The target table on which the new field will be created
Filter“dataset”: {DataSet_JSON}Optional.   If a filter is applied, records not in the filter recordset will be returned as null.
Function"function":"quantile"Quantile
Quantile Field“p1”: “QuantileFieldName”Required.
Supports:  
  • DataType: Discrete
  • FieldType:  Numeric
The field to use when sorting data into quantile segments.
Quantile field is sorted using an alphanumeric sort before being allocated into segments.
Elements“p2”:"NumberofElements"Required. 
Supports:  
  • Fixed Value:  2....250
Determines the number of equal segments that will be created.
10,20,50 and 100 are available as a drop down.
To specify a different number, type in a number between 2 and 250
e.g. 7

JSON Sample

{
  "method": "BuildBakedField",
  "project": "D3",
  "targetTable": "transactions",
  "overwrite": true,
  "name": "price_decile",
  "function": "quantile",
  "p1": "price",
  "p2": "10"
}

Usage Notes

Quantiles are one of the more processing intensive of engineering functions so may take a little longer than others to execute.

See Also:   

  • Engineering | Expression Field
  • Engineering | Decodes
  • Engineering | Banded Fields

Example

ExampleDetails
DescriptionCreate an income decile
Input
  • Table: = [transactions]
  • Filter: = [No Filter]
  • Function: = Quantile
  • Quantile Field:= income
  • Elements:-10
  • Name: =income_decile
Sample





Was this article helpful?