cancel
Showing results for 
Search instead for 
Did you mean: 

percentage not correct

Former Member
0 Kudos

i have a report which shows percentage.

my formula to calc the percent is

if{@season total }= 0 then 0

else if {@TOTAL ORDER COLOR}=0 then 0

else

({@TOTAL ORDER COLOR}/{@season total }*100)

the values i am using are -5586 / -71837 should be 7.78% it is displaying 100%

i know there are issues with percentages in 2008. cant use a sp2 to correct this as it doesnt play well with our lawson app.

anyone know how to fix this?

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

See this post for more info on what to do with percentages:

http://mathforum.org/library/drmath/view/55720.html

Former Member
0 Kudos

that didnt work still shows as 100%

Former Member
0 Kudos

This could be a formatting issue

I have just done a test on a formula which returns 98.75, but in Format -> Number ->customise

If rounding is set to 10 then it returns 100.00

Ian

Former Member
0 Kudos

Try setting the rounding to .01

Former Member
0 Kudos

it is already set to .01

Former Member
0 Kudos

Sorry, I mistook Ian's post for yours. DId you try adding the / 0 to see if you get the actual field values?

Former Member
0 Kudos

i used the formula which made me see that it is dividing by zero, most likely because it is a negative number

how do i account for negative numbers to create a correct percent

Former Member
0 Kudos

Try something like this:

if {A}=0 then 0 else
if {B]/{A}*100 <0 
then {B]/{A}*(-100)   // this will change the negative % to a positive %
else {B]/{A}*100

0 Kudos

Even simpler if you know your numbers will always be both negative or both positive you can use something like this:

(abs(-5586) / abs(-71837)) * 100

If they are not then you can't or you could test each if they are < 0 etc....

Thank you

Don

Former Member
0 Kudos

i converted the negative to positive and it is still showing at 100% where it shoud be 79.04%

i think it would work okay if i used the summary wizard not running totals. but cant sum properly dups

0 Kudos

Weird....

What happens if you create a new formula and use my test: (abs(-5586) / abs(-71837)) * 100

Do you see it correctly now?

If so it must something in the running total that's rounding up....

Thanks

Don

Former Member
0 Kudos

if you have not already, try rounding 0.0001 and check the decimals setting as well

0 Kudos

Hi Sharon,

Lawson should be on SP2. Have you checked with them to see if you can apply SP2? They may have an update to their application also.

I'm on SP3 now. Have you tried SP1 as a test?

Thank you

Don

Former Member
0 Kudos

Is it only when both values are negative?

Its not a fix but this work around could do the trick


local numbervar val;
local numbervar denom;

If {@season total } < 0 then denom:= {@season total }*-1 else denom:= {@season total };

If {@TOTAL ORDER COLOR}< 0 then val:= {@TOTAL ORDER COLOR}*-1 else val:= {@TOTAL ORDER COLOR};


if denom = 0 then 0
//else if {@TOTAL ORDER COLOR}=0 then 0  no need for this test
else
val % denom

Former Member
0 Kudos

thank you but that did not calculate properly. it is not only when they are both negative, it is the first calculation. i have experienced this before when sp2 was not installed.

i was hoping there was a trick to get it to calc properly.

Former Member
0 Kudos

Don,

sp1 is already installed. i am contacting them today to see what needs to be done. I installed sp2 on my local machine, not on the server and the report did not respond well when in the lawson application, it broke the parameters.

Former Member
0 Kudos

with a bit more testing, i dont think the sp2 is the issue, i think the record should percentage is 97.31% and is displaying as 100%

i think its a rounding issue, any ideas on that?

Former Member
0 Kudos

Can you show how the two formula are constructed.

What happens if they are NULL, do you have NULL tests in these formula.

Ian

Former Member
0 Kudos

Hi Sharon, I have CRXI, so I assume 2008 will function in a similar way

Another thing I do, is create an error in the formula

Your Formula

if{@season total }= 0 then 0

else if {@TOTAL ORDER COLOR}=0 then 0

else

({@TOTAL ORDER COLOR}/{@season total }*100)

mine (with an error)

({@TOTAL ORDER COLOR}/{@season total }*100) / 0

when you run it, CR should stop, and show you the values that caused the error.

you will then know for sure, what is being divided by what. Sometimes this information can be

helpfull