# New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for
Did you mean:
Highlighted 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)

• ### swuel

Highlighted MVP

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]))

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)  