{
  "category": "Cubes",
  "display_name": "CUBERANKEDMEMBER",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.CUBERANKEDMEMBER",
  "implementation_state": {
    "answer_bank": null,
    "detail": "No catalogue row at this commit. Pivot tables are being implemented in full, and this function with them.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": false,
    "state": "refuses",
    "state_label": "Refuses or not implemented",
    "summary": "Not yet implemented",
    "workbook_corpus": null
  },
  "implementations": [],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.CUBERANKEDMEMBER.json",
  "name": "CUBERANKEDMEMBER",
  "notes": [],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n### Relationships\n\n\n- **`CUBESET`** — supplies the set and, crucially, its order. `CUBERANKEDMEMBER` cannot be\n  understood without it.\n- **`CUBESETCOUNT`** — the other accessor on a set; gives the loop bound that keeps `rank` in\n  range.\n- **`CUBEMEMBER`** — the other coordinate producer. `CUBEMEMBER` names a member directly;\n  `CUBERANKEDMEMBER` names one positionally. Both feed `CUBEVALUE`.\n- **`CUBEVALUE`** — the consumer that turns the retrieved coordinate into a number.\n\nOutside the family, readers reach for `LARGE`, `INDEX`, or `SORTBY`+`INDEX` by analogy. The\nanalogy is decent for intent and wrong for mechanism: those functions rank data present on the\nsheet, whereas `CUBERANKEDMEMBER` never brings the set to the client.\n\n\n",
    "how-to-implement": "\n### Notes for implementers\n\n\n- The order is not the function's to define. Any implementation must treat rank as an index\n  into a sequence fixed by the set constructor, and must therefore preserve set order\n  faithfully across the boundary — including tie order.\n- Tie handling is a genuine semantic question that neither this function nor `CUBESET`\n  documents. If two members share a `sort_by` value, which is rank 1 — and is that answer\n  stable across recalculations? An implementation that sorts with an unstable algorithm will\n  produce a workbook that changes its answers without any input changing.\n- Because `set_expression` accepts a literal string, a nested call, and a cell reference, the\n  argument must be resolved with the same identity-versus-display rule the rest of the family\n  uses: a referenced cell containing a CUBE function contributes its expression, not its text.\n- The result is scalar-per-call. A modern reimplementation would be tempted to return an array\n  for a range of ranks; that would be a different function, not this one.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nThe result is a member: displayed as a caption, carrying member identity for downstream CUBE\nfunctions. It is a single cell — asking for ranks 1…10 requires ten formulas, not one spilling\ncall. `CUBERANKEDMEMBER` predates dynamic arrays and has no array form.\n\nWhile the request is outstanding the cell displays `#GETTING_DATA…` — a transient\nextended-family placeholder catalogued in [the value universe](../model/01-value-universe.md),\nnot a failure.\n\nThe out-of-range case (`rank` greater than the set's cardinality) is the obvious boundary, and\nthe documentation does not state its result. Real workbooks hit it constantly, because a top-10\nblock over a set that turns out to hold six members is an everyday occurrence. The Handbook\ndoes not know what Excel returns there; it is the first probe listed below.\n\n\n\n### Errors\n\n\nAs documented by Microsoft on the page linked below:\n\n- **`#NAME?`** — the connection name is not a valid workbook connection; or the OLAP server is\n  not running, not available, or returns an error message.\n- **`#N/A`** — the `set_expression` syntax is incorrect, or the set contains at least one\n  member with a different dimension from the others.\n\nMicrosoft's `CUBERANKEDMEMBER` page documents no error for an out-of-range `rank`, and no\n`#VALUE!` condition of the kind its siblings list. Whether that reflects the behaviour or the\ndocumentation is unknown to the Handbook.\n\n\n",
    "sources": "- Microsoft, \"CUBERANKEDMEMBER function\" —\n  <https://support.microsoft.com/en-us/office/cuberankedmember-function-07efecde-e669-4075-b4bf-6b40df2dc4b3>\n  (syntax, all four arguments including the one-based wording of `rank`, the `#GETTING_DATA`\n  remark, and the `#NAME?` and `#N/A` conditions listed above).\n- Microsoft, \"CUBESET function\" —\n  <https://support.microsoft.com/en-us/office/cubeset-function-5b2146bd-62d6-4d04-9d8f-670e993ee1d9>\n  (the `sort_order` table that gives `rank` its meaning).\n- Handbook `data/presence/FUNC.CUBERANKEDMEMBER.json` — no implementation module, no dispatch\n  entry.\n- Handbook `content/model/01-value-universe.md` — the extended error-code family.\n\n",
    "version-differences": "No comparison between specific Excel builds is recorded here yet. This does not establish that all builds behave alike.",
    "what-it-does": "\n`CUBERANKEDMEMBER` is the family's indexer: given a set that lives on the server, it retrieves\nthe item at one position. Microsoft's framing is \"the top sales performer or the top 10\nstudents\", and the \"top\" in that phrase is doing quiet but load-bearing work — see below.\n\n\nThe member at position `rank` of a set, where position 1 is the first item.\n\nThe word to be careful about is *ranked*. `CUBERANKEDMEMBER` does not rank anything. It reads a\nposition out of an order that already exists — the order the set was built in. If the set came\nfrom `CUBESET` with `sort_order` 2 and a `sort_by` measure, then rank 1 genuinely is \"the top\nperformer by that measure\". If the set was built with `sort_order` 0 (`SortNone`, the default),\nrank 1 is simply whichever item the cube happened to return first, and the formula\n`CUBERANKEDMEMBER(conn, mySet, 1)` will read like a top-N query while meaning nothing of the\nkind.\n\nSo the function's real semantics are: **position lookup in a server-defined sequence**, with\nall the ranking meaning imported from the `CUBESET` that produced the sequence. The pairing is\ninseparable, and this is the single most useful thing to understand about the function.\n\nThe standard idiom is a top-N block: one `CUBESET` cell defining and sorting the set, a column\nof `CUBERANKEDMEMBER` cells for ranks 1…N, and a parallel column of `CUBEVALUE` cells reading\nthe measure at each of those coordinates. `CUBESETCOUNT` supplies N when it is not fixed.\n\nLike `CUBEMEMBER`, the resulting cell is dual: its display value is a caption, and its identity\nis the member, which is what `CUBEVALUE` consumes when the cell is referenced.\n\n\n\n### Arguments\n\n\n`CUBERANKEDMEMBER(connection, set_expression, rank, [caption])`\n\n- **`connection`** (required) — text; the name of a connection stored in the workbook, used as\n  a lookup key. Note that `CUBERANKEDMEMBER` takes a connection even when `set_expression` is a\n  reference to a `CUBESET` cell that already has one; `CUBESETCOUNT`, by contrast, takes no\n  connection at all. The asymmetry between the two accessors is not explained by the\n  documentation.\n- **`set_expression`** (required) — text holding an MDX set expression such as\n  `\"{[Item1].children}\"`, *or* a `CUBESET` call, *or* a reference to a cell containing one.\n  Three quite different things share one argument slot.\n- **`rank`** (required) — an integer position. Microsoft: \"If rank is a value of 1, it returns\n  the top value, if rank is a value of 2, it returns the second most top value, and so on.\"\n  One-based, and the documentation says nothing about zero, negative, fractional, or\n  out-of-range values.\n- **`caption`** (optional) — text displayed instead of the cube's own caption.\n\n\n"
  },
  "signature": {
    "display": "CUBERANKEDMEMBER(connection, set_expression, rank, [caption])",
    "parameters": [
      {
        "description": null,
        "name": "connection",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "set_expression",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "rank",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "caption",
        "optional": true,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "not_implemented",
        "reason": "No catalogue row at this commit. Pivot tables are being implemented in full, and this function with them."
      },
      "arity": {
        "max": 4,
        "min": 3
      },
      "category": "Cubes",
      "classification": {},
      "descriptions": {
        "long": null,
        "short": "The member at a given rank in a set from an OLAP cube",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the nth, or ranked, member in a set. Use to return one or more elements in a set, such as the top sales performer or the top 10 students.",
        "microsoft_url": "https://support.microsoft.com/en-us/office/cuberankedmember-function-07efecde-e669-4075-b4bf-6b40df2dc4b3"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "bg-BG",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "cs-CZ",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "da-DK",
          "name": "KUBERANGERET.MEDLEM"
        },
        {
          "locale": "de-DE",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "el-GR",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "en-AU",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "en-GB",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "en-US",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "es-ES",
          "name": "MIEMBRORANGOCUBO"
        },
        {
          "locale": "et-EE",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "fi-FI",
          "name": "KUUTIONLUOKITELTUJÄSEN"
        },
        {
          "locale": "fr-FR",
          "name": "RANGMEMBRECUBE*"
        },
        {
          "locale": "he-IL",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "hr-HR",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "hu-HU",
          "name": "KOCKA.HALM.ELEM"
        },
        {
          "locale": "id-ID",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "it-IT",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "ja-JP",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "ko-KR",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "lt-LT",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "lv-LV",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "nb-NO",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "nl-NL",
          "name": "KUBUSGERANGSCHIKTLID"
        },
        {
          "locale": "pl-PL",
          "name": "USZEREGOWANY.ELEMENT.MODUŁU"
        },
        {
          "locale": "pt-BR",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "pt-PT",
          "name": "MEMBROCLASSIFICADOCUBO"
        },
        {
          "locale": "ro-RO",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "ru-RU",
          "name": "КУБПОРЭЛЕМЕНТ"
        },
        {
          "locale": "sk-SK",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "sl-SI",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "sv-SE",
          "name": "KUBRANGORDNADMEDLEM"
        },
        {
          "locale": "th-TH",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "tr-TR",
          "name": "DERECELİKÜPÜYESİ işlevi"
        },
        {
          "locale": "uk-UA",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "vi-VN",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "zh-CN",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "zh-HK",
          "name": "CUBERANKEDMEMBER"
        },
        {
          "locale": "zh-TW",
          "name": "CUBERANKEDMEMBER"
        }
      ],
      "signature": {
        "display": "CUBERANKEDMEMBER(connection, set_expression, rank, [caption])",
        "parameters": [
          {
            "description": null,
            "name": "connection",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "set_expression",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "rank",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "caption",
            "optional": true,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "CUBERANKEDMEMBER",
      "version_marker": null,
      "xlcall": {
        "code": "383",
        "symbol": "xlfCuberankedmember"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/cuberankedmember-function-07efecde-e669-4075-b4bf-6b40df2dc4b3"
  },
  "try_it": {
    "formula": "=CUBERANKEDMEMBER(\"ThisWorkbookDataModel\",\"[Product].[All Products].Children\",1)",
    "note": "This example needs an Excel cube connection. OneCalc cannot provide that connection in this preview.",
    "preview_status": "refused"
  },
  "url": "https://handbook.dnacalc.com/functions/CUBERANKEDMEMBER.html",
  "variants": [],
  "versions": []
}