1 Reply Latest reply: Apr 26, 2016 12:28 PM by Sunny Talwar

# Sum Values Based on Distinct Value From Other Column

Hello Everyone!

So I have this tables which has a redundant data, and I would like to calculate the sum of one column without the redundancy. My table is similar to:

ID      |     Amount

++++++++++++++++

1        |     1000

++++++++++++++++

1        |     1000

++++++++++++++++

1        |     5000

++++++++++++++++

1        |     5000

++++++++++++++++

2        |     2000

++++++++++++++++

2        |     3000

++++++++++++++++

3        |     6000

++++++++++++++++

4        |     6000

++++++++++++++++

6        |     6000

++++++++++++++++

7        |     6000

++++++++++++++++

So my result should be

ID      |     Amount

++++++++++++++++

1 -------> 6000

++++++++++++++++

2 --------> 5000

++++++++++++++++

3        |     6000

++++++++++++++++

4        |     6000

++++++++++++++++

6        |     6000

++++++++++++++++

7        |     6000

++++++++++++++++

and the total should be:35000

Now I have tried the following, but still it doesn't give me the right answer (the syntax doesn't look right, to me, but since I am new to Sense I thought I should try it.):

sum(aggr(sum(DISTINCT [Amount]), ID))