--- title: "Quantile" slug: "quantile" updated: 2022-02-10T19:36:39Z published: 2022-02-10T19:36:39Z canonical: "docs.datajet.app/quantile" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.datajet.app/llms.txt > Use this file to discover all available pages before exploring further. # Quantile ## 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 | Property | Value | | --- | --- | | **FieldType** | Integer | | **FieldSize** | Low | | **DataType** | Continuous | | **DataSize** | Byte | ```shell Example Return Value: 1.....S where S is the number of segments. ``` ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/Gen_Quantile_Sample.PNG) ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/Gen_Quantile_Profile.PNG) ## Parameters | Parameter | JSON | Description | | --- | --- | --- | | **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 ```json { "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 | Example | Details | | --- | --- | | **Description** | **Create an income decile** | | **Input** | - Table: = [transactions] - Filter: = [No Filter] - **Function: = Quantile** - Quantile Field:= income - Elements:-10 - Name: =income_decile | | **Sample** | ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/Gen_Quantile_Example.PNG) |