# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

## expression

I have data as mention below.

 Type Sub Type Values Y A 100 Y B 200 Y C 300 N A 400 N B 800 N P 900 N R 100 Y A 200 Y B 300 Y C 2000 Y D 3000 N E 100 N F 200 N B 5000 N C 2000

requirement is like i have to calculate sum of Values.

when user select Type Y from list box and respective values from Sub Type list box it should show maximum value of values as sum.

Like if user select Y from Type list box then select A,C,D from another Sub Type list box sum of values should display 3000 that is maximum value.

in another case if user select N from Type list box and A,B,P from Sub Type list box sum of values should be 2100 that is sum of A,B,P.

Please let me know how to get this sum expression to show above requirement.

5 Replies
MVP

## Re: expression

May be this:

Sum({<Type, [Sub Type] = P([Sub Type])>} Values)

UPDATE: I am not sure how you are coming up with those values? Can you elaborate a little?

Not applicable

## Re: expression

I have a similar table as i mentioned and i need to generate the out put like i explain in the question.

Valued Contributor III

## Re: expression

Hi Shantnu, try this expression, this is performed for a table chart.

=Pick(Match(Type,'Y','N'),

Sum(Aggr(Max(Values),[Sub Type],Type)) ,

Sum(Aggr(Min(Values),[Sub Type],Type)))

Regards!!

MVP

## Re: expression

I guess I don't understand the logic you are trying to use . May be Manuel solution is what you need here

## Re: expression

Hi,

It seems that you want Max value and also the Sum of value. Both cant be achieved in single expression.

You need to use two expression, one for Max and one for Sum.

and the expression will be simple.

For Max it will be Max(Values) and for Sum it will be Sum(Values)

Regards,

Kaushik Solanki