Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikuser222
Creator
Creator

Help with round function

Hi Everyone,

 

I need help with round function.

round(0.2461412134614245,.0001)  and    round(0.2753054367009194,.0001)

How can i get the output for the above number as follows - 24.6% and 27.6% ?

 

Thanks

 

6 Replies
pradosh_thakur
Master II
Master II

text box

=round(0.2461412134614245,.001)  * 100 & '%' 

 

 

Learning never stops.
qlikuser222
Creator
Creator
Author

Thnaks,

=round(0.2753054367009194,.001) * 100 & '%'  = 27.5%

 

but i need 27.6%

 

Thanks

dplr-rn
Partner - Master III
Partner - Master III

What is your threshold/logic for the rounding up?
27.53 you want as 27.6 and 24.61 you want as 24.6.
You can use ceil function to force rounding up but it will be becore 27.6 and 24.7 respectively.
danilostochi
Creator II
Creator II

1

=num(ceil(num(num(.2461412134614245)*100),0.01),'#.##0,0')

 

2

=ceil(num(num(0.2753054367009194)*100),0000.1)

 

 

 

+55(44) 9 9993-3605, WhatsApp
E-Mail or Skype - danilo16stochi@hotmail.com
jonathandienst
Partner - Champion III
Partner - Champion III

If its just for display purposes, then keep it simple and use Num():

Num(0.2461412134614245, '%0.0')

 If its for other (non-display) purposes where need the rounded values (eg a dimension), then the % sign may be unnecessary and use:

Round(0.2461412134614245, 1/1000)   // if its used internally or in script
or
Num(Round(0.2461412134614245, 1/1000), '%0.0') // for a dimension
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Brett_Bleess
Former Employee
Former Employee

Some of the guys above have already hit on things, but I am going to through out a Design Blog post for you as well, that might help things make a bit more sense.  The only way I see to get what you want is to change your offset value from .0001 to .001, that should do the trick as well, but as things are, they are working as expected from what I can see.  Using the step option could work, but I am betting you do not want to go up or down a whole integer either.  Thanks to the other guys above comments as well, they are all good, just hoping this one may fill in the gaps a bit for you.

https://community.qlik.com/t5/Qlik-Design-Blog/Rounding-Errors/ba-p/1468808

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.