Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum distinct value

Hello,

I was wondering if anyone can help me.

My data base looks something like this:

TripProductAmmount
11455
12455
13455
24482
25482
364323
47123
5887
5987
610123

My first column is the number of trip, and the Ammount is the total ammount from that trip. This value repeats itself for the same trip number.

Im currently tying to add the total ammount, the problem is that if I sum(Ammount) i would get the duplicated values and my result would be wrong. But if i use sum(Distinct Ammount) it wouldnt work because some Ammounts are repeating even tho its not the same trip.

Is there a way i can use something like sum(Ammount) for every distinct trip???

thanks for the help,

KR

2 Replies
sunny_talwar

Try this:

Sum(Aggr(Only(Ammount), Trip)) or

Sum(Aggr(Avg(Ammount), Trip)) or

Sum(Aggr(Sum(DISTINCT Ammount), Trip))

anlonghi2
Creator II
Creator II

H Mariana,

try using the following expression on a straight table with Trip and Product as dimensions.

f(dimensionality()=0,Sum(Aggr(Sum(DISTINCT Ammount), Trip)) ,sum(Ammount))

Best regards

Andrea