cancel
Showing results for
Did you mean:
Frequent Visitor

Wrong value for calculation

Hi, I have a calculation that is supposed to return the 'next' sales target (they are rewarded for each additional 10% they achieve over a base target)

The formula:

With the inputs of 5000 and 27 for 'new_target' and 'multiplier' respectively I get a result of 15000 but it should be 19000

Working inside out it should be
27+1 = 28
28/10 = 2.8
2.8+1 = 3.8

5000 * 3.8 = 19000

convert to string

convert to int

even if I remove the int(string( part it still give the wrong answer. I have also tried wrapping it in numberFormat(formula, '0') instead. What is going on here?

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User

Hi @Carrotor,

Since your using decimals can you try using float?

``mul(float(items('Get_each_FD_to_update')['new_target']), add(div(add(float(outputs('multiplier')), 1), 10),1))``

2 REPLIES 2
Dual Super User

Hi @Carrotor,

Since your using decimals can you try using float?

``mul(float(items('Get_each_FD_to_update')['new_target']), add(div(add(float(outputs('multiplier')), 1), 10),1))``

Frequent Visitor

Just as this came though I found the same(ish) solution through trial and error. It would appear that dividing two integers will always give an integer result which sounds like something I half remember from a computer science class I took 20 years ago. the final formula I ended up with was:

I figure as the 2 variables are explicitly integers and the result needs to be an integer too, wrapping the 10 in the float seemed most economical.

Announcements

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.