Calculates the value that falls at a given percentile in a group of numbers.

Data Integration reads all rows of data to perform the percentile calculation. The process of reading rows to perform the calculation may affect performance. Optionally, you can apply a filter to limit the rows you read to calculate the percentile.

You can nest only one other aggregate function within PERCENTILE, and the nested function must return a numeric data type. You cannot nest aggregate functions in an elastic mapping.

Use only in mapping tasks.

PERCENTILE( numeric_value, percentile [, filter_condition ] )

Argument | Required/ Optional | Description |
---|---|---|

numeric_value | Required | Numeric data type. Passes the values for which you want to calculate a percentile. You can enter any valid transformation expression. |

percentile | Required | Integer between 0 and 100, inclusive. Passes the percentile you want to calculate. You can enter any valid transformation expression. If you pass a number outside the 0 to 100 range, Data Integration displays an error and does not write the row. |

filter_condition | Optional | Limits the rows in the search. The filter condition must be a numeric value or evaluate to TRUE, FALSE, or NULL. You can enter any valid transformation expression. |

Numeric value.

NULL if all values passed to the function are NULL, or if no rows are selected (for example, the filter condition evaluates to FALSE or NULL for all rows).

If a value is NULL, PERCENTILE ignores the row. However, if all values in a group are NULL, PERCENTILE returns NULL.

PERCENTILE groups values based on group by fields you define in the transformation, returning one result for each group.

If there is no group by field, PERCENTILE treats all rows as one group, returning one value.

Data Integrationcalculates a percentile using the following logic:

Use the following guidelines for this equation:

- •x is the number of elements in the group of values for which you are calculating a percentile.
- •If i < 1, PERCENTILE returns the value of the first element in the list.
- •If i is an integer value, PERCENTILE returns the value of the ith element in the list.
- •Otherwise PERCENTILE returns the value of n:

The following expression returns the salary that falls at the 75th percentile of salaries greater than $50,000:

PERCENTILE( SALARY, 75, SALARY > 50000 )

SALARY |
---|

125000.0 |

27900.0 |

100000.0 |

NULL |

55000.0 |

9000.0 |

85000.0 |

86000.0 |

48000.0 |

99000.0 |

RETURN VALUE: 106250.0 |

© Copyright Informatica LLC 2007, 2021