Focal Point
calculating percentage

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9251074732

July 17, 2007, 02:56 PM
Madhu
calculating percentage
Hi All,

I need your help on this. I tried my best but couldn't figure it out.

In the .mas file I am trying to do this

DEFINE DAYS30/D6.2% = (TOTAL / (TOTAL + M_ONE)) * 100;, TITLE = 'DAYS30',$

Total and M_ONE are database fields and the datatype is float.

The problem here is I am not getting correct result. For EX TOTAL has 11326 and M_ONE has 1350 and I should get 89% but I am getting 801%

Thanks for any help


Madhu

WF Version 7.1 Windows, SQL Server Database
July 17, 2007, 03:20 PM
Leah
Wonder if you are being bit by not having the field define large enough decimals, to handle the decimals prior to the multiplication? or do you need to multiply by 100 since the descriptor is assuming a percentage?


Leah
July 17, 2007, 03:25 PM
Madhu
I did try with D20.2 and without % as well.
I am having the same problem


Madhu

WF Version 7.1 Windows, SQL Server Database
July 17, 2007, 03:52 PM
mgrackin
Madhu,

Does your request do a PRINT or a SUM? You may be aggregating multiple records if you are getting 801%. It is impossible to get over 100% with the calculation you have.


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
July 17, 2007, 04:25 PM
Madhu
Thanks Mickey for pointing me in right direction

Let me work on this Little more,I think I Know what the problem is. Will get back soon.


Madhu

WF Version 7.1 Windows, SQL Server Database
July 22, 2007, 10:32 AM
FrankDutch
Madhu

Are the two fields in the same segment of the database?

Did you try to use this defined field in a define instead of in the master?

Is the result then also wrong?




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

August 13, 2007, 04:28 PM
Madhu
Hi Frank,

Sorry I did not notice your post. As Mickey pointed out, It was aggregating. That problem is solved.

Thank you


Madhu

WF Version 7.1 Windows, SQL Server Database