Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
apthansh
Creator
Creator

sum agg and Total

I have the below expression - I want to calculate the Total aggregate by ID...How can I do that.

1.Expression1:

sum(aggr(
if(GetFieldSelections([Type])='Sub',

(If(GetSelectedCount(Currency)>0,
sum([Annual Expense ]/Factors),
sum([Annual Expense ]))*-1),


If(GetSelectedCount(Currency)>0,
sum([Annual Expense ]/Factors),
sum([Annual Expense ]))),[ID]))

 

2:Expression 2 :

sum(Total(aggr(
if(GetFieldSelections([Type])='Sub',

(If(GetSelectedCount(Currency)>0,
sum([Annual Expense ]/Factors),
sum([Annual Expense ]))*-1),


If(GetSelectedCount(Currency)>0,
sum([Annual Expense ]/Factors),
sum([Annual Expense ])))),[ID]))

The expression is not working.Any help please.

Secons expression 

 

Labels (4)
1 Reply
Anil_Babu_Samineni

Is this working for you?

if(GetFieldSelections([Type])='Sub', (If(GetSelectedCount(Currency)>0, sum([Annual Expense ]/Factors), sum([Annual Expense ]))*-1), If(GetSelectedCount(Currency)>0, sum([Annual Expense ]/Factors),
sum([Annual Expense ])))

May be like this?

sum(TOTAL <ID> aggr(if(GetFieldSelections([Type])='Sub', (If(GetSelectedCount(Currency)>0, sum([Annual Expense ]/Factors), sum([Annual Expense ]))*-1), If(GetSelectedCount(Currency)>0, sum([Annual Expense ]/Factors),
sum([Annual Expense ]))),[ID]))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful