Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

AGGR function

I have data in a table :

Client_IDIN/OUTISINdatePriceQTY
1I619-Sep-1210300
1I719-Sep-1211250
1O719-Sep-1211100
1O619-Sep-1210250
2I719-Sep-1211100
2O719-Sep-121150
2I819-Sep-129500

I have an issue where im trying to use the aggr function. I would like data output to be in the following form:

Client IDValue
12150
25050

Value =

aggr( sum( if(      sum(

                              if  (IN/OUT='O' , -QTY, QTY)

                              )>'0' ,

Price * sum(if(IN/OUT='O',- QTY, QTY ) )

                )   )

,ISIN)  

So for ClIENT_ID=1 the value would be 150 * 1+ 50 *10 =2150

But somehow the above function isnt working in a straight table.

Regards

Faisal

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe like this?

=sum(

aggr(

if( sum(  if  ([IN/OUT]='O' , -QTY, QTY) )>'0' ,

Price * sum(if([IN/OUT]='O',- QTY, QTY ) )   )  

, Client_ID,ISIN)

)

View solution in original post

2 Replies
swuehl
MVP
MVP

Maybe like this?

=sum(

aggr(

if( sum(  if  ([IN/OUT]='O' , -QTY, QTY) )>'0' ,

Price * sum(if([IN/OUT]='O',- QTY, QTY ) )   )  

, Client_ID,ISIN)

)

Not applicable
Author

What about this?

Sum(DISTINCT Aggr(sum( if("IN/OUT"='O',- QTY, QTY ) ) *Price,Client_ID,ISIN ) )

With Client_ID as dimension