# Custom sprint velocity calculation

**URL:** <https://community.eazybi.com/t/custom-sprint-velocity-calculation/10364>\
**Category:** Questions & Answers\
**Tags:** jira, mdx\
**Created:** [August 17, 2022, 9:42pm UTC](https://community.eazybi.com/t/custom-sprint-velocity-calculation/10364 "2022-08-17T21:42:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dahun\_Mamora](https://community.eazybi.com/user_avatar/community.eazybi.com/dahun_mamora/32/7838_2.png) [@Dahun\_Mamora](https://community.eazybi.com/u/Dahun_Mamora)\
**Post date:** [August 17, 2022, 9:42pm UTC](https://community.eazybi.com/t/custom-sprint-velocity-calculation/10364/1 "2022-08-17T21:42:27Z")

</div>

Hello. I’m trying to setup a custom velocity calculation in EazyBi. I want to account for the status of the ticket at the start & end of the sprint when calculating velocity…

Velocity = [Ticket 1\_story point x (status at the end of sprint - status at the start of sprint)] + [Ticket 2\_story point x (status at the end of sprint - status at the start of sprint)] + …

- Status values:  
To do: 0  
In progress: 0.25  
In testing: 0.5  
In review: 0.75  
Closed: 1

For example, if we have 3 tickets in a sprint, and:

- Ticket 1 is 2 story points, and transitioned from **to do** → **closed** during the sprint
- Ticket 2 is 5 story points (was carried over from the previous sprint), so transitioned from **in testing** → **closed** during the sprint
- Ticket 3 is 2 story points and transitioned from in **to do** → **in review** during the sprint

velocity = [2 x (1 - 0)] + [5 x (1 - 0.5)] + [2 x (0.75 - 0)] = 6  
as opposed to 7 (which is what the current velocity calculation will say).

Can someone please advise how I can write this in code? Thanks!

---

<div class="post-metadata">

**Author:** ![Dahun\_Mamora](https://community.eazybi.com/user_avatar/community.eazybi.com/dahun_mamora/32/7838_2.png) [@Dahun\_Mamora](https://community.eazybi.com/u/Dahun_Mamora)\
**Post date:** [August 23, 2022, 7:49pm UTC](https://community.eazybi.com/t/custom-sprint-velocity-calculation/10364/2 "2022-08-23T19:49:19Z")

</div>

Following up on this, please. Help will be appreciated.

---

<div class="post-metadata">

**Author:** ![janis.plume](https://community.eazybi.com/user_avatar/community.eazybi.com/janis.plume/32/8826_2.png) [@janis.plume](https://community.eazybi.com/u/janis.plume)\
**Post date:** [August 29, 2022, 2:38pm UTC](https://community.eazybi.com/t/custom-sprint-velocity-calculation/10364/3 "2022-08-29T14:38:50Z")

</div>

Hi,

The following formula counts the story points at the sprint end and applies the respective weights depending on the status:

```mdx
([Measures].[Sprint Story Points at closing],
[Transition Status].[In Progress])*0.25
+
([Measures].[Sprint Story Points at closing],
[Transition Status].[In Testing])*0.5
+
([Measures].[Sprint Story Points at closing],
[Transition Status].[In Review])*0.75
+
([Measures].[Sprint Story Points at closing],
[Transition Status].[Closed])

```

Kindly,  
Janis, eazyBI support

---

<div class="post-metadata">

**Author:** ![Dahun\_Mamora](https://community.eazybi.com/user_avatar/community.eazybi.com/dahun_mamora/32/7838_2.png) [@Dahun\_Mamora](https://community.eazybi.com/u/Dahun_Mamora)\
**Post date:** [August 30, 2022, 4:16pm UTC](https://community.eazybi.com/t/custom-sprint-velocity-calculation/10364/4 "2022-08-30T16:16:52Z")

</div>

Thanks @janis.plume for the response! I have a few additional questions:

- How do you also account for the status at the start of the sprint, such that we can use this formula:  
Velocity = [Ticket 1\_story point x (status at the end of sprint - **status at the start of sprint** )] + [Ticket 2\_story point x (status at the end of sprint - **status at the start of sprint** )] + …

- In EazyBi, is “closing” the status when we click “complete sprint”, or the status by the end pf the day that the sprint is completed? I’m asking because I had written formula for status at closing, but the status that was returned was not the status when I clicked “complete sprint”
