Hello!
I am trying to calculate an employees monthly income, as well as what 1.5% of that monthly income is to determine minimum premiums. These results need to be in $ format and only have 2 decimal places
I have annual salary set as a custom field in one Jira project, and it generates a ticket in a different Jira project, and calculates the math. I have annual salary set as customfield_26121
This is the formula I have so far:
EE salary: {{customfield_26121}}
Monthly gross income: ${{#=}}{{customfield_26121}} / 12{{/}}
Most EE can contribute (1.5% of income): ${{#=}}({{customfield_26121}} / 12) * 0.015{{/}}
How can I update this formula to limit the result to 2 decimal places?
I've tried the following formats from Gemini for calculating monthly income, but they have resulted in an error:
${{ {{#=}}({{customfield_26121}} / 12) * 0.015{{/}}.format("#.00") }}
${{#=}}(({{customfield_26121}} / 12) * 0.015).round(2){{/}}
${{#=}}(({{customfield_26121}} / 12) * 0.015).format("#.00"){{/}}
Is your custom field's value an integer or a floating point number value? The type impacts the math operation used because the first value in an expression (integer or floating point) impacts what happens for division, multiplication, etc. with inline expressions.
With an integer, the long-format math expression is used rather than inline, so please try the other format for the ROUND function. That result would need to be stored in a created variable and then converted back into a number before formatting later.
With a floating point number, you may do the division inline and then use the format() function directly.
For more information on how the math operations proceed based on the value types, please see this related article I wrote on variables used as numbers:
Kind regards,
Bill
Hi @Nick Pacifico,
Can you give this a try:
{{#=}}ROUND(({{customfield_26121}} / 12) * 0.015, 2){{/}}
Hope this helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi! I tried the updated version but I'm running into the same error as the previous attempts. The new ticket doesn't generate and I get this error:
Do you know what the blocker might be?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nick Pacifico -- Based upon the audit log you show, there is a problem accessing one or more fields in the work item you are trying to create.
Please post an image of your complete rule, in a single image for continuity, and an image of the Create Work Item action. These will provide more context for the error you are seeing in the audit log. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.