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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum and Division in Load/Select without Grouping ?

Hi All,

I am new to qlikview.

I have below question.

While We Load/Select Data in Load Statement,

I would also like to do Sum of two fields which are Numeric and I was to divide that Sum By 2.

How can we do that in Qlikview ?

Example :

Load

      A,

      B,

      ((A+B)/2) AS C

Resident D;

Any help would be Appreciated.


6 Replies
maxgro
MVP
MVP

yes you can sum, divide, etc at the row level (or using info from different row with interrecord function, see online help)

t:

load * inline [

a,b

1,2

3,4

5,6

];

t2:

load

*,

(a+b)/2 as c,

(a+b) * previous(a) as d

Resident

  t;

1.png

its_anandrjs
Champion III
Champion III

Yes you can do the same by using any resident table load

See the Example

tmpTable:

Load * inline

[

A,B

2,3

4,6

6,3

4,6

];

Calculations:

Load

      A,

      B,

      ((A+B)/2) AS C

Resident tmpTable;

Not applicable
Author

Anand,

can you please help with below ?

have a questions - how can we append leading zero in front of numbers and make it in 10 digit ? 

Example :

We have : 12345

how can we make it - 0000012345 ?

Appreciate your help.

its_anandrjs
Champion III
Champion III

Add new field in the load script see the example

LOAD *,Num(Val,'0000000000') as NewVal;

LOAD * Inline

[

Val

12345

];

Joseph_Musekura
Support
Support

Hi,

A possible way  is to format the values as text by using Text() during reload.

Load   text(F1) as F1,  F2 inline [
F1, F2
1, a
01, b
0002, c
000003, d
4, f

]

a problem with this approach is that a  value formatted with Text() will not  be used in calculations.

Regards

Not applicable
Author

Thanks Anand.

Can you please see my new question in forum ?

"Issues in the Comparision of two fields ?"

Thanks for your kind help.