Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
realpixel
Contributor III
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

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
Contributor III
Contributor III
Author

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

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
Contributor III
Contributor III
Author

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

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