Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all,
I'm new in qlikview.. how can i divide two fields in qlikview.
Emp: Field a = 233149
Field b= 199125.
My problem is that when i use Div(a,b) result shown 1 in qilkview but i want it shows 1.1708..
Hi,
Just simple thing that is
Load Field_A,
Field_B,
Field_A/Field_B as Diff
from Table;
Just write
FieldA / FieldB
Let me know
We should not use Div(a/b). Instead use Field a / Field b
Please check below:
div( 7,2 ) returns 3
div( 9,3 ) returns 3
Div() will return integer part of the result, hence you have divide two fields like Alexandros17 said.
Dear Alessandro,
Thnx for ur reply.. In Expressions TAB your solution is not working..
Hi,
Only use ( / ) symbol for division or you can store value in variable also
load *, Field a / Field b as Division
Load * iline
[
Field a, Field b
233149,199125
];
Or
Let vFielda = 233149;
Let vFieldb = 199125;
Let vDivision = $( vFielda ) / $( vFieldb )
Regards
Anand
Dear anand
thnx for ur reply.. After using Div function my fraction value not showing. how can i handle fraction value...
Hi Masba,
As Anand stated, you are trying to perform a simple Arithmetic Division so you should be using: / as your operator
From QV Help.
/ Arithmetic division. The operation returns the ratio between the two operands.
Using Div () is Integer Divsion and so will always return a whole number
From QV Help
Integer division. Both parameters are interpreted as real numbers, i.e. they do not have to be integers. The result is the integer part of the result of the arithmetic division, a real number.
Examples:
div( 7,2 ) returns 3
div( 9,3 ) returns 3
div( -4,3 ) returns -1
div( 4,-3 ) returns -1
div( -4,-3 ) returns 1
What object you are using,what is your dimension ?
FieldA/FieldB should give the right value.
Check for the number formats too.
Dear Masba,
If you use DIV it will always returns the integer value but if you need exact result of divide you can go for variables or tables to divide two numbers see example for this
Load *,
[Field a] / [Field b] as Division,
Div([Field a] , [Field b]) as ByDiv;
Load * inline
[
Field a, Field b
233149,199125
];
Regards,
Anand