Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Please try like this -
round(0.5,-1) as ...
Thank you!
Not sure but this gives the result as you needed -
=Round(3.5,-1)
What about Round (x -0.1,1)
Simply subtract 1/10th?