Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
jaimeeduardo_gc
Contributor II
Contributor II

Round from 3 to 2 digits

Hi everyone,

I need to round all my expressions from 3 digits to 2 digits, but having this consideration:

IF the last digit is <= 5 then round down.

For example:

3.715 -> 3.71

6.453 -> 6.45

Else if the last digit is > 5 then rown up

3.716 ->3.72

1.347 -> 1.35

I will appreciate all the suggestions.

Thanks for helping me!!

1 Solution

Accepted Solutions
sunny_talwar

How about this

=Round(Number-0.000000000001, 0.01)

or even this

=Round(Number-0.001, 0.01)

View solution in original post

2 Replies
joseph_eftamand
Partner - Creator
Partner - Creator

Have you tried the round function?

https://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/ChartFunctions/GeneralNu...

For example =round(0.856,0.01) will output 0.86, while =round(0.853,0.01) will output 0.85.

To get the functionality where x <= 5 rounds down you could just use a conditional statement for example:

if(mid($(a),5,1) ='5',round($(a),0.01) - 0.01,round($(a),0.01))

where a = 0.845 you will find you get the right result.

Hope it helps.

sunny_talwar

How about this

=Round(Number-0.000000000001, 0.01)

or even this

=Round(Number-0.001, 0.01)