Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Division with decimal values

Hello,

How can I in qlikview divide two decimal value in order to keep the decimal part. For example:

Value1 = 5,5

Value2 = 2,2

Value3=5,5/2,2

I have tried the following:

Value3 = Value1/Value2: does not work, does not return a valid result;

Value3 = div(Value1,Value2): does not work, returns only the Integer part of division, in this case 2

Can anyone help?

Thank you!

4 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Are you sure that your numbers use comma instead of dot?

Have you tried: 5.5/2.2

... but where have you tried? In an expression? in a text box?

Let me know

hic
Former Employee
Former Employee

You must use decimal point for all numbers hardcoded in the script or in an expression. Example

Let variable = 5.5 / 2.2 ;

When you display it, you can choose to format it using a decimal comma, using the Num() function.

HIC

Not applicable
Author

Well Guys I sorted the problem.

The 5.5 and 2.2 where just an example for what I was trying to do.

My final expression is: Value1/num($(Value2)))*100

and this works with the division bar '/'.

Thank your for the help!!

hic
Former Employee
Former Employee

I suspect that you will get the same result if you try

     Value1/$(#Value2)*100

Note the hash - it forces a numeric expansion using decimal point.

HIC