Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
new_guy
Contributor III
Contributor III

sum distinct

Hey guys

I want to sum values bot only for an other distinct column. Here is a little example 

 

Column A: Number        (Values: 1,    2, 3, 3, 4,  4,   5)

Column B: sum: Hours (Values: 10,20,5,5, 10,10,5)

So the right sum would be 50, my result is 65. Can anyone give me a little hint?

test.JPG

1 Solution

Accepted Solutions
Ivan_Bozov
Luminary
Luminary

Maybe try this: SUM(AGGR(SUM(DISTINCT Hours), Number))

Or use LOAD DISTINCT in your script.
vizmind.eu

View solution in original post

5 Replies
Ivan_Bozov
Luminary
Luminary

Maybe try this: SUM(AGGR(SUM(DISTINCT Hours), Number))

Or use LOAD DISTINCT in your script.
vizmind.eu
new_guy
Contributor III
Contributor III
Author

Thanks for your answer, but it's not working 😞 

Within the LOAD script would be a little difficult, since I have a lot of other things that dont have to be distinct loaded 

Ivan_Bozov
Luminary
Luminary

What is the issue? Do you get an error? Wrong number?

vizmind.eu
new_guy
Contributor III
Contributor III
Author

It worked, I somehow managed to copy our statement with a mistake Smiley Very Happy Thank you!

jmcdermott
Contributor III
Contributor III

Thanks,  this fixed my issue as well.  I had Sum(DISTINCT{<invoice>}cost)  where in my details I was getting $866 as cost but needed to get $1829  your formula corrected it, what was wrong with my formula?

invoicecost 
92922|233483      545.27 
92922|233776      321.05 
92922|233777      321.05 
92922|233778      321.05 
92922|233779      321.05 
    1,829.48    866.32
 correctincorrect