Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Money doesn't not gives proper result

I have a variable X which is set as 'Money' in number tab and format is set as $#,##0.0# ;($#,##0.0#)

But,

for X=61.825, it shows as $61.82 instead of $61.83

                         here, it doesn't round up 2->3 where it should be.

for X=61.855, it shows as correct value i.e. $61.86

                         here, it rounds up correctly i.e. 5->6

Rounding has the problem for 0.825, 0.835, 0.845

works fine for .855

Is there any way to get the proper expected result?

4 Replies
Not applicable
Author

a small correction, X is not a variable but it is an expression.

Not applicable
Author

from reference manual here some rounding functions:

ceil(x [ , base [ , offset ]])

Rounding of x upwards to the nearest multiple of base with an offset of offset. The result is a number.

Examples:

ceil( 2.4 ) returns 3

ceil( 2.6 ) returns 3

ceil( 3.88 , 0.1 ) returns 3.9

ceil( 3.88 , 5 ) returns 5

ceil( 1.1 , 1 , 0.5 ) returns 1.5

floor(x [ , base [ , offset ]])

Rounding of x downwards to the nearest multiple of base with an offset of offset. The result is a number.

Examples:

floor( 2.4 ) returns 2

floor( 2.6 ) returns 2

floor( 3.88 , 0.1 ) returns 3.8

floor( 3.88 , 5 ) returns 0

round(x [ , step [ , offset ]])

Rounding of x upwards or downwards n number of steps with an offset of offset. The result is a number. If x

is exactly in the middle of an interval, it is rounded upwards. The function complies with the IEEE standard

64-bit floating point numbers.

Examples:

round( 2.4 ) returns 2

round( 2.6 ) returns 3

round( 2.5 ) returns 3

round( 3.88 , 0.1 ) returns 3.9

round( 3.88 , 5 ) returns 5

round( 1.1 , 1 , 0.5 ) returns 1.5

should solve your problem

Not applicable
Author

I had tried all possible functions, but had no luck .

Focussing more,

if number in the second decimal digit is less than 5 and third decimal number is 5

i.e. 0.115 OR 0.125 OR 0.135 OR 0.145, round funct always remain as it is i.e. 0.11,0.12,0.13 OR 0.14.

but, for 0.155 it comes expected as 0.16

Round(10.235, 0.01) = 10.23

But my expectaion is 10.24

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   Try this

     $#,##0.00 ;($#,##0.00)

Regards,

Kaushik Solanki    

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!