6 Replies Latest reply: Mar 11, 2015 2:55 PM by Staffan Johansson

# Sum with aggr or total?

Hi all!

I have a table similar below, where I need count people in groups A and in subgroups A1. In the sum for A1 the expression that Im use is:  sum(Ind_Ative) and this WORKS OK. But in the sum for a group A, I need that total for a group is repeated in all lines for the group. Im use the expression: sum(aggr ( sum(Ind_Ative), Group_A))

But the result is like below, where the value just appear in one lines.

Any idea?

Thanks!

 Group A Group A1 Ind_Active for group A1 Ins_Active  for Group A 23 1 0 0 129 1 590 590 166 1 117 205 166 2 16 0 166 4 2 0 166 6 70 0 200 1 2147 0 200 2 19 2363 200 4 78 0 200 5 116 0 200 6 0 0 200 8 2 0 200 9 1 0 200 10 0 0 201 1 6 19 201 2 3 0 201 3 10 0
• ###### Re: Sum with aggr or total?

maybe

sum ( total <Group_A> Ind_active)

• ###### Re: Sum with aggr or total?

I tryed this but not worked because the total was global for all groups.

• ###### Re: Sum with aggr or total?

can you post a small .qvw?

• ###### Re: Sum with aggr or total?

In fact, this sum ( total <Group_A> Ind_active)
should work, I tested in the simple example. But in my applicattion that be very most hard this does not wok...still the group A and subgroup are in the same table.

The result is the total sum for all groups.
Any idea?

• ###### Re: Sum with aggr or total?

Try

sum({<Group A1=>} total <Group A> Ind_active)

• ###### Re: Sum with aggr or total?

Hi, Use th NODISTINCT in your expression:

sum( aggr (NODISTINCT sum( [Ind_Active for group A1]),[Group A]))