Loading TOC...

MarkLogic Server 11.0 Product Documentation
math:percent-rank

math:percent-rank(
   $arg as xs:anyAtomicType*,
   $value as xs:anyAtomicType,
   [$options as xs:string*]
) as xs:double?

Summary

Returns the rank of a value in a data set as a percentage of the data set. If the given value is not equal to any item in the sequence, the function returns the empty sequence. See math:rank.

Parameters
arg The sequence of values.
value The value to be "ranked".
options Options. The default is ().

Options include:

"ascending"(default)
Rank the value as if the sequence was sorted in ascending order.
"descending"
Rank the value as if the sequence was sorted in descending order.
"collation=URI"
Applies only when $arg is of the xs:string type. If no specified, the default collation is used.
"coordinate-system=name"
Applies only when $arg is of the cts:point type. If no specified, the default coordinate system is used.

Example

  math:percent-rank((1, 7, 5, 5, 10, 9),9)

  => 0.833333333333333

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.