Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to divide if smart value could be zero

Kari Laine March 24, 2025

 

 

I want to create an automation that shows how many filtered cases I had last week. Everything works fine if I have at least one case. What should I do to ensure that the automation and Smart Values accept a value of zero?

1 answer

1 accepted

0 votes
Answer accepted
Jack Brickey
Community Champion
March 24, 2025

Hi @Kari Laine you could use an advanced compare condition in your rule

  {{lookupIssues.size|0}} is greater than or equal to 1
Kari Laine March 24, 2025

Thank you, here is more information:
PrioOneSum = A special field that sums the values of all filtered cases → result in X minutes.
PrioOneAll = The total number of filtered cases → in other words, how many cases there are.
This formula works if I have at least one case:
{{#=}}{{prioOneSum}} / {{prioOneAll}}{{/}}

However, there could be weeks when there are no filtered cases, and both values could be zero or empty.

 

Jack Brickey
Community Champion
March 24, 2025

Can you explain "filtered cases", how is this expressed? Why not just have a condition before the component that has the formula to check if {{prioOneAll}} is not zero?

Maybe if you shared screenshots of your actual role, I can assist further.

Kari Laine March 24, 2025

More information:

1. First I have filter, what must be True ( correct Customer + last week + correct priority etc.)
"* VALUE[dropdown]" = " VALUE1 " AND Organizations = " VALUE2 "
AND "VALUE3[Dropdown]" = "VALUE4"
AND "* VALUE5[Time stamp]" >= startOfWeek(-7d)
AND "* VALUE5[Time stamp]" < startOfWeek()
AND "* VALUE5[Time stamp]" IS NOT EMPTY

AUTOMATION

Lookup issues // filter=XYZ
2a. Create variable // variablename -> prioOneCases
2b. Smart value // {{lookupIssues}}

3a. Create variable // variablename -> prioOneAll
3b. Smart value // {{lookupIssues.size}}

4a. Create variable // variablename -> prioOneSum
4b. Smart value // {{lookupIssues.customfield_10133.asNumber.sum}}

SEND EMAIL

Print all case Ids = {{prioOneCases}}
Print cases calculated all together = {{prioOneSum}} minutes
Print how many cases all together : {{prioOneAll}}
Print average fixing time : {{#=}}{{prioOneSum}} / {{prioOneAll}}{{/}} minutes

 

***** UPDATE*****

 

 

Thank you for help, this started to work as I wanted:

Create "extra" variable = safeDivisor 

{{#=}} if({{lookupIssues.size|0}} > 0, {{prioOneAll.asNumber}}, 1) {{/}}

SEND MAIL

{{#=}} {{prioOneSum.asNumber|0}} / {{safeDivisor}} {{/}}

Like Jack Brickey likes this

Suggest an answer

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

Atlassian Community Events