# Qlik Sense App Development

New Contributor

## Qlik Sense how to round 0.5 down to 0

I am working in Qlik Sense Enterprise 3.2.  I have some numbers that I need to round by a non-standard rule.  Typically, if the decimal portion of a number is >= 0.5, then the rule is to round up to the next whole number; else, round down.  However, I have a different rounding rule in my particular situation.  If the decimal portion of a number is <= 0.5, then round down; else, round up.  So, for example...

0.5 becomes 0

2.5 becomes 2 (not 3)

2.4 becomes 2

2.6 becomes 3

3.5 becomes 3 (not 4)

How can I implement this rounding rule in my load script?  The round function in Qlik Sense doesn't let you control the rule (only the increment and offset), and ceiling / floor are not the rounding behavior that I want.  I'm thinking floor the original number to trim off the integer portion, implement some if-then logic on the decimal portion (returning 0 or 1), and then add the result of the if-then logic to the integer portion of the number.  But, I'm not sure if this is the best approach.

Tags (1)
1 Solution

Accepted Solutions
Contributor III

## Re: Qlik Sense how to round 0.5 down to 0

round(0.5,-1) as ...

Thank you!

3 Replies
Contributor III

## Re: Qlik Sense how to round 0.5 down to 0

round(0.5,-1) as ...

Thank you!

Honored Contributor III

## Re: Qlik Sense how to round 0.5 down to 0

Not sure but this gives the result as you needed -

=Round(3.5,-1)

Valued Contributor