Restrict sprint within board

Hi, I have multiple board and each board containing multiple sprints. So when I am using Sprint dimension in the page it is displaying all the sprints in each board, it is not in order and it is difficult to navigate.

Ask: how to restrict number of sprints displaying under each board, may be last 5 closed sprints plus active sprint for each board.

Hi!

There are options on how to filter Sprints when they are on rows, but when in Pages, the dimension shows all members in that hierarchy level (all sprints in the board).

I can suggest creating a new hierarchy in the Sprint dimension by importing an additional property to Sprint - Board name only to the last five closed sprints and all future sprints. Then you could create a new custom hierarchy where under Board, you would have only last five closed and all future Sprints while all older Sprints would be grouped under (none) member.

It would look like this - Sprints in D1 Board start from 1, but here in the D1 board we can see the last five, starting from Sprint 14:

Following is a REST API import definition where there is a calculation with JavaScript

Sprint REST API definition with JS to only return Board name to last five closed and active/future sprints
{
  "application_type": "rest_api",
  "application_params": {
    "source_params": {
      "url": "JIRA_BASE_URL/rest/agile/1.0/board/",
      "pagination": "offset_limit",
      "incremental": null,
      "incremental_stop_import": null,
      "authentication_type": "basic",
      "username": "",
      "content_type": "json",
      "custom_javascript_code": "// retrieves all sprints within one board and will go from the last sprint to get last five closed and active and future sprints\nvar sprints = [];\nvar allSprintsLoaded = false;\nvar startAt = 0;\nvar maxResult = 50;\nif (doc.type == \"scrum\") {\n  // loads all closed sprints of a board.\n  do\n  {\n    result = getDocument( \"/rest/agile/1.0/board/\" + doc.id + \"/sprint?state=closed&startAt=\" + startAt + \"&maxResults=\" + maxResult, {ignoreErrors: [404]});\n    if (result && result.values ) {\n      sprints = sprints.concat(result.values);\n      allSprintsLoaded = result.isLast;\n      startAt = startAt + maxResult;\n    }\n  }\n  while (!allSprintsLoaded);\n\n   \n  // print board name for last five closed sprints\n  if (sprints) { \n      for(var i = sprints.length-1; i>= 0; i--) {\n        var sprint = sprints[i];\n        if (sprint && i > sprints.length-6) {\n        sprints[i].board_name = doc.name;\n       }\n    }\n  }\n\n  var j = sprints.length-1;\n  allSprintsLoaded = false;\n\tstartAt = 0;\n\tmaxResult = 50;\n\n  // loads all active sprints of a board.\n  do\n  {\n    result = getDocument( \"/rest/agile/1.0/board/\" + doc.id + \"/sprint?state=active&startAt=\" + startAt + \"&maxResults=\" + maxResult, {ignoreErrors: [404]});\n    if (result && result.values ) {\n      sprints = sprints.concat(result.values);\n      allSprintsLoaded = result.isLast;\n      startAt = startAt + maxResult;\n    }\n  }\n  while (!allSprintsLoaded);\n\n   \n  // print board name for last five closed sprints\n  if (sprints) { \n      for(var i = sprints.length-1; i>= j; i--) {\n        var sprint = sprints[i];\n        if (sprint) {\n        sprints[i].board_name = doc.name;\n       }\n    }\n  }\n  \n  j = sprints.length-1;\n  allSprintsLoaded = false;\n  startAt = 0;\n  maxResult = 50;\n\n  // loads all active sprints of a board.\n  do\n  {\n    result = getDocument( \"/rest/agile/1.0/board/\" + doc.id + \"/sprint?state=future&startAt=\" + startAt + \"&maxResults=\" + maxResult, {ignoreErrors: [404]});\n    if (result && result.values ) {\n      sprints = sprints.concat(result.values);\n      allSprintsLoaded = result.isLast;\n      startAt = startAt + maxResult;\n    }\n  }\n  while (!allSprintsLoaded);\n\n   \n  // print board name for last five closed sprints\n  if (sprints) { \n      for(var i = sprints.length-1; i>= j; i--) {\n        var sprint = sprints[i];\n        if (sprint) {\n        sprints[i].board_name = doc.name;\n       }\n    }\n  }\n}\n \n// this will pass the sprint set for mapping and import\nreturn sprints;",
      "json_data_path": "$.values",
      "offset_parameter": "startAt",
      "limit_parameter": "maxResults",
      "limit_value": 50
    },
    "extra_options": {
      "regular_import_frequency": null,
      "regular_import_at": "",
      "time_zone": ""
    }
  },
  "source_cube_name": "Issues",
  "columns": [
    {
      "name": "id",
      "data_type": "integer",
      "dimension": "Sprint",
      "dimension_level": "Sprint",
      "key_column": true,
      "skip_missing": true
    },
    {
      "name": "self",
      "data_type": "string"
    },
    {
      "name": "state",
      "data_type": "string"
    },
    {
      "name": "name",
      "data_type": "string"
    },
    {
      "name": "startDate",
      "data_type": "datetime"
    },
    {
      "name": "endDate",
      "data_type": "datetime"
    },
    {
      "name": "completeDate",
      "data_type": "datetime"
    },
    {
      "name": "activatedDate",
      "data_type": "datetime"
    },
    {
      "name": "originBoardId",
      "data_type": "integer"
    },
    {
      "name": "goal",
      "data_type": "string"
    },
    {
      "name": "board_name",
      "data_type": "string",
      "dimension": "Sprint",
      "dimension_level": "Sprint",
      "property": "Board"
    }
  ]
}

After importing this definition in the Source data tab, please make sure to specify your authentication parameters and JIRA_BASE_URL in the Source Data URL section.

Let me know if this helps and if you have any further questions!
Lauma / support@eazybi.com