Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
stvn_003
Contributor III
Contributor III

Sum Distinct

I want to show a total on a label, but when I add the amount ignored repeated amounts, which relamente I want is to add the amounts of each sales order once, but instead only sum the amount of each sales order which they are different.

This is the formula I use:

SUM( {$<occ_cesvl = {'01'}, occ_sclnok = {'N'}>} DISTINCT occ_imp_bru)

As exist two equal amounts, only considers one.

Sin título.jpg

1 Solution

Accepted Solutions
sunny_talwar

Try this instead:

=Sum(Aggr(Sum({$<occ_cesvl = {'01'}, occ_sclnok = {'N'}>} occ_imp_bru), SalesOrderField))


=Sum(Aggr(Avg({$<occ_cesvl = {'01'}, occ_sclnok = {'N'}>} occ_imp_bru), SalesOrderField))

View solution in original post

5 Replies
sunny_talwar

Try this instead:

=Sum(Aggr(Sum({$<occ_cesvl = {'01'}, occ_sclnok = {'N'}>} occ_imp_bru), SalesOrderField))


=Sum(Aggr(Avg({$<occ_cesvl = {'01'}, occ_sclnok = {'N'}>} occ_imp_bru), SalesOrderField))

sunny_talwar

In your case if SalesOrderField is called [Nro OC], then this:

=Sum(Aggr(Sum({$<occ_cesvl = {'01'}, occ_sclnok = {'N'}>} occ_imp_bru), [Nro OC]))


=Sum(Aggr(Avg({$<occ_cesvl = {'01'}, occ_sclnok = {'N'}>} occ_imp_bru), [Nro OC]))

antoniotiman
Master III
Master III

Try to remove DISTINCT

jagan
Luminary Alumni
Luminary Alumni

HI,

Try this

=Sum({<occ_cesvl = {'01'}, occ_sclnok = {'N'}>} Aggr(Sum({<occ_cesvl = {'01'}, occ_sclnok = {'N'}>} DISTINCT occ_imp_bru), [Nro OC]))

Regards,

Jagan.

stvn_003
Contributor III
Contributor III
Author

Thanks Sunny T, great!