Roll up story points into the epic
Action: Roll up values from child work items (Roll up)
The problem
An epic's story points should be the total of its stories, and the initiative's the total of its epics. Jira doesn't keep those totals in a field, so rules can't use them and they don't show on boards or in filters.
The native workaround
A rule on "Story Points changed" branches to the parent and sets its field to
{{lookupIssues.Story Points.sum}} from a lookup of parent = {{issue.key}}. The lookup sees at
most about 100 work items, each level needs its own rule, and the total drifts when a story moves
to another epic or is deleted, because nothing recalculates the old epic.
With Kenshall Automation Actions
In a rule triggered by Field value changed: Story Points (and, if you like, **Work item created), add Roll up values from child work items**:
- Update: The parent of the rule's work item
- Calculation: Sum
- Field to roll up: Story Points (or Story point estimate)
- Write to: The same field
- Also update higher levels: on, to keep initiatives in step too
Every run recalculates the total from scratch, so re-runs never double-count, and the write is skipped when nothing changed. A story without sub-tasks keeps its own points, and so does a story whose sub-tasks have none, so the rule can safely run for every work type.
Fix drift nightly: a second rule on a Scheduled trigger, with Update set to _Every work item
a JQL search finds_ and JQL issuetype = Epic AND statusCategory != Done, recalculates every epic,
including those whose stories moved or were deleted. Allow the project on the Safety tab first.
Use one re-sync rule per level (epics, then initiatives an hour later), because work items in one
run are recalculated in parallel. The nightly run also corrects totals left slightly stale when
many stories changed at the same moment, for example in a bulk edit.
Other calculations: count, average, lowest and highest value, earliest and latest date (for example the epic's due date from its stories), and % done by status, optionally weighted by story points. "Only children that aren't done" gives the remaining points. Time totals work too: Original estimate and Remaining estimate roll up into the same estimate, or into a number field in hours.
Smart values: {{updatedKenshallRollup.value}}, .number, .previousValue, .count,
.skipped, .workItem, .changed and .updated, so a next step can, for example, comment when
an epic passes 40 points.
Limits: 1,000 children per parent, 5 levels, 100 work items per re-sync run (so a run answers Automation within about 20 seconds; split larger re-syncs into several rules). A re-sync also stops at the Safety tab's cap (500 by default). When more work items match, or the run runs out of time, the rule stops with one sentence saying how far it got, and the Run log shows the run as partly done. Work items it recalculated keep their new totals. Narrow the JQL, raise the cap, or run the rule again.
