# Aggregate Sprint By Name

**URL:** <https://community.eazybi.com/t/aggregate-sprint-by-name/6591>\
**Category:** Questions & Answers\
**Tags:** dataimport, hierarchy, sprint\
**Created:** [April 12, 2021, 5:20pm UTC](https://community.eazybi.com/t/aggregate-sprint-by-name/6591 "2021-04-12T17:20:46Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![zane.baranovska](https://community.eazybi.com/user_avatar/community.eazybi.com/zane.baranovska/32/7209_2.png) [@zane.baranovska](https://community.eazybi.com/u/zane.baranovska)\
**Post date:** [May 11, 2021, 12:56pm UTC](https://community.eazybi.com/t/aggregate-sprint-by-name/6591/3 "2021-05-11T12:56:42Z")

</div>

Here is an example of REST API that would import **Week cycle** as **Sprint property**.  
This Sprint property will pick the Sprint start date and show it to the Monday of that week, and import the property with this pattern: %yW%U, %b %d %Y, for example, **20W39, Sep 28 2020** - year, week number, and week start date)

To use this code:

1. In Source Data (where you already have Jira as a data source), select **“Add new source application”**.

2. Chose the option to **“import definition”** and paste in the code below:

> **Import definition for new data source**
>
> ```auto
> {
> "application_type": "rest_api",
> "application_params": {
> "source_params": {
> "url": "http://jira811.internal:8810/rest/agile/1.0/board?type=scrum",
> "pagination": "offset_limit",
> "incremental": null,
> "incremental_stop_import": null,
> "authentication_type": "basic",
> "username": "admin",
> "content_type": "json",
> "custom_javascript_code": "\n\n// retrieves all sprints within one board and will go from the last sprint and rank decreasingly closed sprints\nvar sprints = [{\n sprint_id: null,\n sprint_week: null \n}];\nvar allSprints = [];\nvar allSprintsLoaded = false;\nstartAt = 0;\nmaxResult = 50;\nif (doc.type == \"scrum\") {\n\n do \n {\n result = getDocument( \"/rest/agile/1.0/board/\" + doc.id + \"/sprint?startAt=\" + startAt + \"&maxResults=\" + maxResult, {ignoreErrors: \"404\"});\n if (result && result.values ) {\n allSprints = allSprints.concat(result.values);\n allSprintsLoaded = result.isLast;\n startAt = startAt + maxResult;\n }\n }\n while (!allSprintsLoaded); \n \n if (allSprints ) { \n for(var i = 0; i < allSprints.length; i++) {\n var sprint = allSprints[i];\n if (sprint && sprint.originBoardId == doc.id ) {\n \n if (sprint.startDate) {\n date = new Date(Date.parse(sprint.startDate));\n date.setUTCDate(date.getUTCDate() + 1 - (date.getUTCDay()||7));\n sprints.push({\n sprint_id: sprint.id,\n sprint_week: strftime(\"%yW%U, %b %d %Y\", date)\n });\n }\n }\n }\n} \n\n}\nreturn _.uniq(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": "Helsinki"
> }
> },
> "source_cube_name": "Issues",
> "columns": [
> {
> "name": "sprint_id",
> "data_type": "integer",
> "dimension": "Sprint",
> "dimension_level": "Sprint",
> "key_column": true,
> "skip_missing": true
> },
> {
> "name": "sprint_week",
> "data_type": "string",
> "dimension": "Sprint",
> "dimension_level": "Sprint",
> "property": "Week cycle"
> }
> ]
> }
> 
> ```

1. **Adjust** the **REST API source parameters** (URL, authentification) to match your Jira instance ([Import from REST API](https://docs.eazybi.com/eazybi/data-import/import-from-rest-api#ImportfromRESTAPI-RESTAPIsourceparameters))

2. Import data.

3. In the report, Sprint dimension, choose to **add custom hierarchy** and select property “Weekly cycle” ([Create reports](https://docs.eazybi.com/eazybijira/analyze-and-visualize/create-reports#Createreports-AddcustomhierarchiestospecificJira,Confluence,andInsightdimensions)).

Here are several reports in **eazyBI Demo Training** account created based on this custom hierarchy:  
[**Sprints by weeks balance**](https://eazybi.com/accounts/22010/cubes/Issues/reports/725641-sprints-by-weeks-balance)  
[**Sprints by weeks velocity**](https://eazybi.com/accounts/22010/cubes/Issues/reports/787607-sprints-by-weeks-velocity)  
[**Sprints by weeks current cycle story points burn-down**](https://eazybi.com/accounts/22010/cubes/Issues/reports/787624-sprints-by-weeks-current-cycle-story-points-burn-down)

Best,  
Zane / [support@eazyBI.com](mailto:support@eazyBI.com)

---

_[View the full topic](https://community.eazybi.com/t/aggregate-sprint-by-name/6591)._
