Array Formulas in Quire Permalink
An array formula in Quire lets you work with a collection of values—such as tasks, subtasks, assignees, numbers, or durations—all at once. Instead of calculating values one by one, array formulas allow you to perform bulk calculations and return multiple results or a single aggregated result.
Understanding Array Formulas
An array is a list of values, usually separated by commas. In Quire formulas, arrays are commonly returned when you reference multiple items, such as subtasks or task fields.
For example, instead of calculating schedule variance for a single task:
timeSpent - estimated
You can calculate schedule variance for all subtasks at once using an array formula:
subtasks.timeSpent - subtasks.estimated
Because subtasks returns a list, Quire performs the calculation for each subtask individually and returns a list of results.
Using Array Formulas for Basic Calculations
Arithmetic Operators
Array formulas support all basic numeric operators:
- Addition (
+) - Subtraction (
-) - Multiplication (
*) - Division (
/)
Example scenario:
- Subtask time spent:
3h, 2h, 1h - Subtask estimated time:
1h, 2h, 3h
When you write:
subtasks.timeSpent
Quire interprets it as:
[3h, 2h, 1h]
Using an array formula:
subtasks.timeSpent - subtasks.estimated
Is evaluated as:
[3h, 2h, 1h] - [1h, 2h, 3h]
Resulting in:
[2h, 0h, -2h]
Each value in the array represents the calculation result for one subtask.
Using Array Formulas with Operators and Functions
Combining with Functions
Array formulas can be used together with Quire’s built-in operators and functions for more advanced analysis.
Using the same time spent example, you can sort values and perform calculations:
SORT(subtasks.timeSpent) * 2
This is interpreted as:
SORT([3h, 2h, 1h]) * 2
And returns:
[2h, 4h, 6h]
This makes it easy to transform and analyze collections of task data.
Filtering Data with Array Formulas
Filtering with where
You can filter arrays using the where operator to return only items that meet specific conditions.
Example: Filter subtasks where time spent is greater than or equal to 2 hours:
subtasks where any.timeSpent >= 2h
This evaluates to:
[3h, 2h]
And returns the corresponding tasks:
subtask 1, subtask 2
This formula searches all subtasks, applies the condition, and returns only the matching items.
Note: Use the any identifier with where to specify which field the condition applies to.
Read more on our blog about Quire’s array formulas.
Frequently Asked Questions
What is an array formula in Quire?
An array formula works on a collection of values all at once. For example, subtasks.timeSpent - subtasks.estimated calculates the schedule variance for every subtask and returns a list of results.
How do I calculate a value across all subtasks in Quire?
Reference the field on the subtasks object — for example, subtasks.timeSpent - subtasks.estimated calculates the difference for each subtask and returns an array of results.
How do I sort an array of subtask values in a Quire formula?
Wrap the array in SORT() — for example, SORT(subtasks.timeSpent) returns subtask time values from smallest to largest. You can chain operations like SORT(subtasks.timeSpent) * 2.
How do I filter subtasks by a condition in a Quire array formula?
Use the where operator with any — for example, subtasks where any.timeSpent >= 2h returns only subtasks where time spent is 2 hours or more.