Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

realpixel
New Contributor III

sum lines

Hello,

I need to have in the field [RES1] the value under.

NbreTA et NbreT are an expression

7 = sum (ALCL + SOCO) = 3 + 4

I don’t know, if it’s possible to have an expression like that or maybe an another method.

RES1 = Sum field [NbreT] if  CAM=ALCL + (CAM=SOCO and CAM=OKI) and if LOC is not null

ZP

Nbre TA

Nbre T

CAM

LOC

RES1

ZP

2

3

ALCL

-

7

ZP

3

4

SOCO

SOCO

0

ZP

5

9

SOCO

-

9

10

16

16

5 Replies
Not applicable

Re: sum lines

Try this as expression:

If(CAM = 'ALCL', NT + Below(total NT),if(CAM = 'SOCO' and LOC = '',NT,0)) or

If(CAM = 'ALCL', NT + Below(total NT),if(CAM = 'SOCO' and isnull(LOC),NT,0))

realpixel
New Contributor III

Re: sum lines

What does NT? It's NbreT no?

I try this expression

If(CAM = 'ALCL', NbreT + Below(total NbreT),if(CAM = 'SOCO' and LOC = '',NbreT,0)) or

If(CAM = 'ALCL', NbreT + Below(total NbreT),if(CAM = 'SOCO' and isnull(LOC),NbreT,0))

The value returns are false

-1

0

-1

Not applicable

Re: Re: sum lines

Yes NT means NbreT no. I just tried to replicate your data. Can you please see the attached file. It gives me expected results.

Thanks,

Angad

realpixel
New Contributor III

Re: Re: Re: sum lines

Hello,

I add some value in your example.

ZPNTCAMLOCIf(CAM = 'ALCL', NT + Below(total NT),if(CAM = 'SOCO' and LOC = '',NT,0))
0
ZP3ALCL 7
ZP4SOCOSOCO0
ZP9SOCO 9
ZP11OKIOKI0

Try to explain if CAM = ALCL and LOC=SOCO + OKI we must to do the sum 3 + 4 + 11 = 18 the other value not change.

I want to have in new column

ZPNTCAMLOCRES1
27
ZP3ALCL 18
ZP4SOCOSOCO0
ZP9SOCO 9
ZP11OKIOKI0
Not applicable

Re: Re: Re: sum lines

You need to play with the If statements, since your requirement is very specific. I think you would have to make nested IF conditions to achieve this.

Hope that helps you