Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

yura_ratu
Contributor II

Calculations not in all rows

Hello guys,

When I try to make arithmetic operations with values in rows result is calculated only in rows where exist every part of expression. Here is example

sample:

load * inline [

ID, T1, T2

1, 1, 1

2, , 1

3, 1, 1

4, 1,

]

;

Left Join (sample)

LOAD

  ID,

  T1+T2 as SUM

Resident sample

;

Result is

2014-05-06 16.31.22.png

How can calculate sum for every row? So, for ID 2 and 4 it should be 1

Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: Calculations not in all rows

Instead of

.....

  T1+T2 as SUM

try like:

RangeSum(T1, T2) as SUM

3 Replies
MVP
MVP

Re: Calculations not in all rows

Instead of

.....

  T1+T2 as SUM

try like:

RangeSum(T1, T2) as SUM

jagannalla
Valued Contributor III

Re: Calculations not in all rows

Try this.

sample:

LOAD ID,If(T1='',0,T1) as T1,If(T2='',0,T2) as T2;

load * inline [

ID, T1, T2

1, 1, 1

2, , 1

3, 1, 1

4, 1,

];

Left Join (sample)

LOAD

  ID,

  T1+T2 as SUM

Resident sample

;

yura_ratu
Contributor II

Re: Calculations not in all rows

It works. Thanks

Community Browser