Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version next

...

Excerpt

Extracts the ranked value from the values in a column, where k=1 returns the maximum value. The value for k must be between 1 and 1000, inclusive. Inputs can be Integer, Decimal, or Datetime.

For purposes of this calculation, two instances of the same value are treated as separate values. So, if your dataset contains three rows with column values 10 , 9 , and 9 , then KTHLARGEST returns 9 for k=2 and k=3 .

...

Input column can be of Integer, Decimal, or Decimal Datetime type. Non-numeric data in the column is Other values column are ignored. If a row contains a missing or null value, it is not factored into the calculation.

D s

D s
snippetBasic

KTHLARGEST
d-code-lang-syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextpivot value:
kthlargest(myRating, 2) group:postal_code limit:1

...

kthlargest(myRating, 2)

Output: Returns the second highest value from the myRating column for that postal_code value. The limit parameter defines the maximum number of output columns.

D s
snippetSyntax

KTHLARGEST
d-code-lang-syntax
RawWrangletrue
Typesyntax
showNotetrue
WrangleTextpivot value:
kthlargest(function_col_ref, k_integer) [ group:group_col_ref] [limit:limit_count]

kthlargest(function_col_ref, k_integer) [ group:group_col_ref] [limit:limit_count] 


ArgumentRequired?Data TypeDescription
function_col_refYstringName of column to which to apply the function
k_integerYinteger (positive)The ranking of the value to extract from the source column

...

Name of the column the values of which you want to calculate the mean. Column  Inputs must contain be Integer, Decimal, or Decimal valuesDatetime values.

Info

NOTE: If the input is in Datetime type, the output is in unixtime format. You can wrap these outputs in the DATEFORMAT function to generate the results in the appropriate Datetime format. See DATEFORMAT Function.

  • Literal values are not supported as inputs.
  • Multiple columns and wildcards are not supported.

...