Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Decimal And Rounding Issue


Hello Everybody,

I am experiencing some issue in calculating the sum and rounding it off.

Below is the code I am using

round(Sum(( [Gross Premium]))/ApplyMap('Map_Policy_Total',p_v_s),.000000001)  as [Risk_Perc],
Sum(( [Gross Premium]))/ApplyMap('Map_Policy_Total',p_v_s)    as [Risk_Perc_Actual],

Num([Risk_Perc_Actual]* 100 ,'#,##0.00000')        as [Risk%]
[Risk_Perc_Actual]* 100         as [Risk1%]


I want the sum of [Risk_Perc_Actual] should be exact 100. I tried all the decimal places with 6,7,8,9 and original value also withoput any decimal points.

But for some policies I am getting thy sum as 100 and for some I am not.

For Example:

If I am using 6 decimal places I am getting the sum for some policies as 100.000000 but for some policies I am getting 100.000001

with 7 decimal also for some policies I am getting 100.0000000 and for some policies I am getting 99.9999999

And if I am using Round function also It's not working for all the policies.


Please Advise


Thanks In Advance

Sonali

4 Replies
isorinrusu
Partner - Creator III
Partner - Creator III

Hi,

Maybe what you should do is try to round one, and rest it from the total for the other one.

Further than that, I don't understand really your code. Could you provide an example please?

Regards,

Sorin.

Anonymous
Not applicable
Author

use Num(Sum(Values),'##,##0')

or round function

NickHoff
Specialist
Specialist

Use Floor()

MarcoWedel

Hi,

maybe interesting in this context:

Rounding Errors

regards

Marco