Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Divide

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..

1 Solution

Accepted Solutions
Not applicable
Author


Hi,

Just simple thing that is

Load Field_A,

         Field_B,

         Field_A/Field_B as Diff

from Table;

View solution in original post

12 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Just write

FieldA / FieldB

Let me know

Not applicable
Author

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

senpradip007
Specialist III
Specialist III

Div() will return integer part of the result, hence you have divide two fields like Alexandros17 said.

Not applicable
Author

Dear Alessandro,

Thnx for ur reply.. In Expressions TAB your solution is not working..

its_anandrjs

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

Not applicable
Author

Dear anand

thnx for ur reply.. After using Div function my fraction value not showing. how can i handle fraction value...

awhitfield
Partner - Champion
Partner - Champion

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

sujeetsingh
Master III
Master III

What object you are using,what is your dimension ?

FieldA/FieldB should give the right value.

Check for the number formats too.

its_anandrjs

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

];

Div.png

Regards,

Anand