Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum Distinct <Field>

Hello everyone,

I'm trying to sum some values from a field based on another one. I would like to use something like Sum(TOTAL <Invoice Number> Sales) but, instead to use TOTAL I need to use Distinct, due to I have many re-invoices numbers belonging to the same original invoice, and of course, I need to sum just one time each.

Thanks in advance!!!

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

I think you have a problem in the original data. Try to understand why you have duplicate value for a unique invoice.

But you can try this :

sum( Aggr( Max( Sales ) , Invoice Number)) )

This function retain one value for each invoice.

JJ

View solution in original post

2 Replies
Not applicable
Author

Hi,

I think you have a problem in the original data. Try to understand why you have duplicate value for a unique invoice.

But you can try this :

sum( Aggr( Max( Sales ) , Invoice Number)) )

This function retain one value for each invoice.

JJ

Not applicable
Author

Jean-Jacques,

Very smart and very easy solution. The situation is a little complicated to explain. But your solution works perfect!!! Thank a lot!!!