ALM Structure Formula: Count unique assignees of children

KD September 6, 2022

Hi there-

I am trying to use a Formula column to display the number of unique assignees in the children of a folder. 

For example, if there are 3 children tasks under folder, 2 of which are assigned to John and 1 is assigned to Jane, I would like the Formula to display: 2.

I can get the unique assignees successfully as text values with this....

IF type = "epic" OR type = "story" :
VALUES#children { assignee.UNIQUE() }

But I am struggling to find a way to display the above as just a number. I have tried just replacing VALUES in the above formula with COUNT but then the number displayed stops showing me 'unique' and only shows me a total. 

Thoughts on how I can achieve this? I'm sure it mustn't be that hard but I am still very new to using this formula language.

1 answer

1 accepted

1 vote
Answer accepted
Nicholas Ellis _ALM Works_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
September 6, 2022

Hi Kota,

Your code is really close, you just need to add the size function, to return the number of occurrences, instead of the unique list of assignees, like this:

IF type = "epic" OR type = "story" :
VALUES#children { assignee }.unique().size()

Please let me know if you have any other questions.

Cheers,
Nick [ALM Works]

KD September 7, 2022

Wow close indeed! Thank you @Nicholas Ellis _ALM Works_ !

I do have one more question, do you know how to alter this formula to include the sum of all nested children? 

Below is an example of the result I am getting - as you can see the column is showing the sum of children but only 1 level deep.

formula.png

Nicholas Ellis _ALM Works_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
September 7, 2022

Hi Kota,

This is actually really easy.  All you need to do is change #children to #subtree.  The children modifier means only direct children (i.e. one level below).  The subtree modifier will search the entire subtree (i.e. all levels below).  Here is the documentation if you are interested to learn more.

Cheers,
Nick [ALM Works]

Like David Niro likes this
KD September 7, 2022

Oh awesome :) Ty so much, this has helped me understand the language a lot more!

After trying #subtree, I experimented around with different modifiers in the documentation and found that #leaves is even better for my use case. With how my Structure is designed, #leaves will sum Assignees at the task level and exclude the parent level Epic/Story owners from the count, but still show the right count all the way back to the top of the hierarchy. So per my image example above, using #leaves, the value I am getting at the top Epic level is 2. 😍 

Super helpful, thanks again!

Like David Niro likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events