12 Replies Latest reply: Mar 29, 2016 3:38 AM by rgv rand

# sum problem

hii

i have two column in below tableie icdcode_alha and icdcode_num .

i want do sum on this and if there sum goes beyond >0.7 then its an 'outlier' if not then its 'not outlier'

(i want to use if condition and inline function)

 Icdcode_alpha Icdcode_num T 2.9 T 2.8 T 2.7 T 2.6 T 2.5 T 2.4 T 2.3 S 43.3 S 43.2 S 43.1 S 43 S 42.9 S 42.8 S 42.7 S 42.4 S 42.3 S 42.2 S 42.1

help me in dis as i m new on qlikview .

• ###### Re: sum problem

Create table

Dimension:

icdcode_alha

Expression:

=if(sum(Icdcode_num)>0.7,'Outlier','not Outlier')

• ###### Re: sum problem

Kush141087 thank you for ur help

but if we have do count function with inline function on this then how to do it .

• ###### Re: sum problem

COUNT({\$

<Icdcode_num = {'=SUM(Icdcode_num)>0.7'}>

} Icdcode_alpha)

Set Analysis: syntaxes, examples

• ###### Re: sum problem

What's an 'inline function' ?

• ###### Re: sum problem

Icdcode_alpha , Icdcode_num

T, 2.9

T, 2.8

T, 2.7

T, 2.6

T, 2.5

T, 2.4

T, 2.3

S, 43.3

S, 43.2

S, 43.1

S, 43

S, 42.9

S, 42.8

S, 42.7

];

in this way do direct data adding

• ###### Re: sum problem

And what does 'i want do sum on this and if there sum goes beyond >0.7' mean?  All values are larger than 0.7.

• ###### Re: sum problem

sry not sum just count want to do it count and if it goes beyond >0.7 then oulier

• ###### Re: sum problem

All values are larger then 0.7.

T1:

LOAD *, if(Icdcode_num>0.7,1,0) as Counter INLINE [

Icdcode_alpha , Icdcode_num

T, 2.9

T, 2.8

T, 2.7

T, 2.6

T, 2.5

T, 2.4

T, 2.3

S, 43.3

S, 43.2

S, 43.1

S, 43

S, 42.9

S, 42.8

S, 42.7

];

T2:

sum(Counter) as CountOfOutliers

RESIDENT

T1

;

• ###### Re: sum problem

I am still not clear but do you want this

Data:

if(Sum_Icdcode>0.7,'outlier','not outlier') as Flag;

Icdcode_alpha ,

Count(Icdcode_alpha) as Count_Icdcode,

Sum(Icdcode_num) as Sum_Icdcode

Group by Icdcode_alpha;

Icdcode_alpha , Icdcode_num

T, 2.9

T, 2.8

T, 2.7

T, 2.6

T, 2.5

T, 2.4

T, 2.3

S, 43.3

S, 43.2

S, 43.1

S, 43

S, 42.9

S, 42.8

S, 42.7

];

• ###### Re: sum problem

kush141087 just want count not sum

• ###### Re: sum problem

the use  Count_Icdcode in IF condition instead of Sum

• ###### Re: sum problem

count({<Icdcode_num={'=Sum(cdcode_num)>0.7'}>}Icdcode_alpha)