Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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

Your help is appreciated.

1 Reply
sunny_talwar

What are the values you are getting? For example for ID = 1, what is the Amount coming out to?