I’m working on automating capacity calculations for my development team using JQL in Structure plugin. Currently, I have to manually modify the formula every quarter, which takes a lot of time. I want to define variables at the beginning of my query so I only need to change values in one place.
Here’s what I’m trying to achieve:
WITH developer_name = "john.smith":
WITH team_lead = "sarah.jones":
WITH qa_member = "mike.brown":
WITH current_sprint = "*Release 24.1 (week7-8)*":
WITH next_sprint = "*Release 24.2 (week9-10)*":
WITH base_capacity = 8:
WITH team_member = "john.smith":
WITH display_name = "John":
WITH high_threshold = 1.2:
WITH low_threshold = 0.8:
if ( status = "current_sprint", concat(
if(ceiling(number(sum{if(match(fixVersion,"current_sprint") and reporter = "team_member", story_points)},0),1) > base_capacity * high_threshold, "{color:red}",
if(ceiling(number(sum{if(match(fixVersion,"current_sprint") and reporter = "team_member", story_points)},0),1) < base_capacity * low_threshold, "{color:orange}", "{color:green}")),
display_name, ":", ceiling(number(sum{if(match(fixVersion,"current_sprint") and reporter = "team_member", story_points)},0),1), "/", base_capacity
))
The problem is that the variables don’t seem to work as expected in the formula. How can I properly declare and use variables in Structure JQL queries?
Structure plugin doesn’t support WITH variable declarations like that. You’re trying to use SQL syntax, but JQL formulas work differently.
I hit this same problem managing sprint capacity across multiple teams. Updating formulas manually every quarter was a huge time sink.
Honest answer? Automate it. Don’t fight JQL’s limitations - build workflows that handle the calculations and updates for you.
I created a system that pulls Jira data, runs capacity calculations with whatever variables I need, then updates Structure formulas automatically. No more quarterly manual updates or syntax headaches.
It watches for sprint changes, team assignments, and capacity thresholds. Something changes? It recalculates everything and pushes updates back to your Structure views.
Set up all your variables in one config file - dev names, sprint patterns, capacity values, color thresholds. Change them once and automation does the rest.
Latenode makes this Jira automation pretty simple. Connect to the API, process your data however you want, and auto-update your Structure plugin.
I tried this exact same thing last year and yeah, Structure doesn’t do variables like that. I ended up using Jira’s custom fields to store my constants instead. Create number fields for base_capacity, text fields for sprint names, etc. Then reference them in your formula with customfield_xxxxx. It’s a bit hacky but when sprints change you just update the custom field values once and all your Structure formulas pull the new data automatically. Way better than editing formulas every quarter.
Structure plugin JQL doesn’t support real variables. Those WITH statements won’t work - it’s not SQL.
I used to manually update capacity formulas every sprint until I got sick of it. Now I handle this completely outside JQL.
The real solution? Pull your Jira data through the API, calculate everything with actual variables in a proper programming environment, then push results back to custom fields or comments.
You can set up variables for developer names, sprint patterns, capacity thresholds - whatever you need. When sprints change or team composition shifts, it automatically recalculates and updates your Structure views.
I built workflows that monitor sprint transitions and team changes. When something triggers, it grabs current data, runs the capacity math with my predefined variables, applies color coding logic, then writes clean results back to Jira.
No more fighting JQL limitations or quarterly manual updates. Just pure automation doing the heavy lifting.
Latenode handles the Jira API connections and data processing really well for this workflow.
The WITH syntax doesn’t work in Structure plugin formulas. I wasted months trying to get variable declarations working before figuring out that Structure treats each WITH as its own calculation context instead of real variable assignment. Here’s what actually fixed it for me: use Structure’s item hierarchy. Create parent items to store your constants (sprint names, capacity numbers, thresholds) as calculated fields. Then reference them in child formulas with ancestor() functions. When quarters change, you just update the parent values once and everything refreshes automatically. For your capacity formula, stick base_capacity as a calculated field in a parent item, then call ancestor().base_capacity in your main formula. Do the same for sprint patterns and team configs. Your formulas get way cleaner and you only have to update parent values instead of hunting down multiple complex formulas every quarter. This saved me tons of time vs manual updates everywhere.
Structure plugin doesn’t support WITH syntax or variable declarations like that. I ran into the same problem when tracking team capacity across projects. Here’s what worked for me: create separate generator items for each component (sprint names, capacity values, etc.) instead of trying to define variables at the top. Then reference those calculated values in your main formulas using parent() or ancestor() functions. When sprint names change, you just update the generator item and everything else updates automatically. It’s not as clean as real variables, but it beats manually updating everything quarterly. Also check out Structure’s formula sharing feature - you can create reusable templates for different team views.