I have an automation statement where I am working out % complete and this rolls up to show %complete in the parent Epic. It all works ok but occassionally, the child issues in the Epics have no Story Points and therefore I get a divide by 0 error. I've been trying to use IF to make this conditional so that if varTotalStoryPoints.asNumber is zero, I just assign 0 to the variable and avoid the divide by zero error but I just cant get the syntax right - can anybody help please ?
{{#=}} {{varStoryPointsComplete.asNumber}} / {{varTotalStoryPoints.asNumber}} * 100 {{/}}
Hi @Ian Rees
Try using the smart value math expressions - Functions :
{{#=}} IF({{varTotalStoryPoints.asNumber}} > 0,{{varStoryPointsComplete.asNumber}}/{{varTotalStoryPoints.asNumber}}*100,0) {{/}}.
You might want to consider using asPercentage (also with a locale option) when formatting for display to avoid having to do the * 100.
Hi @Stanley, Rob that's the syntax I've been trying but can't seem to get it right - for instance {{#=}} IF({{varTotalStoryPoints.asNumber}} > 0,{{varStoryPointsComplete.asNumber}}/{{varTotalStoryPoints.asNumber}}*100,0) {{/}}.
gives unexpected comma error
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This worked for me is stopping the divide by zero error
{{#=}} IF({{varTotalStoryPoints.asNumber.eq(0)}},0,{{varStoryPointsComplete.asNumber}} / {{varTotalStoryPoints.asNumber}} * 100){{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ian Rees
Just wrap your "Edit Issue"-Action inside an if-else block with an "Advanced Compare"-Condition which checks whether {{varTotalStoryPoints.asNumber}} is 0. If it is: "Edit Issue"-Action -> Set field to 0, else "Edit Issue"-Action -> Set field to MathExpression.
Final section should look something like this:
Note: Change Description to the field you want to edit. First Edit sets the field to 0 - Second edit sets the field to the expression.
Hope this helps. Feel free to reach out if there are any problems with this.
Greetings
Gideon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Ian Rees
For this automation, the 'If Else' construct would be required. From the available details, I understand that you are storing the Total Story Points and Story Points Complete in variables.
So, when we select the If clause, opt for the 'Advanced compare condition'. The settings should be:
I hope this helps set up the IF condition. Please reach you if you have any follow-up questions.
Kindly accept the answer if this helps.
Regards,
--GG
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.