Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
jduenyas
Specialist
Specialist

Sum of distinct

Hi all

I have this sort of table:

QuoteNumberQuoteValueOrderNumberOrderValue
1000500
10013505001250
10027505002500
10013505003500
10036005004400
1004300
10027505005350
1005100050061000

Quotes and orders. Some quotes do not have orders, others have orders for the same value of the quote or more (or less) and some quotes have multiple orders.

I wish to sum the total of distinct quotes only. So for instance quote number 1001 and 1002 should be totaled only once. The total of column QuoteValue should then be 3500 (not 4600)

I then want to divide the total of the OrdersValue by the total of the QuotesValues to get the rate of return (win ratio) of my quotes.

Your help is appreciated

Thanks

Josh

1 Solution

Accepted Solutions
albertovarela
Partner - Specialist
Partner - Specialist

Hello,

Try this for to sum distinct quotes ~ QuotesValue:

=sum(aggr(distinct QuoteValue,QuoteNumber))

This for OrdersValues:

=sum(OrderValue)

and finally, for the rate of return:

sum(OrderValue) / sum(aggr(distinct QuoteValue,QuoteNumber))

Hope this helps...

View solution in original post

4 Replies
maxgro
MVP
MVP

Try the attachments

jduenyas
Specialist
Specialist
Author

Thank you Massimo but I am afraid this is not correct because it will sum on the distinct VALUE of the quote and not on the distinct quote. So if there is another quote, lets say 1006 with value of 600 and it had an order 5007 for 600, it will not be added to the total of distinct QUOTES

Quote numberQuote ValueOrderNumberOrderValue
1000500
10013505001250
10027505002500
10013505003500
10036005004400
1004300
10027505005350
1005100050061000
10066005007600

Total of distinct QUOTES should be now 4100 but your calculation will still be 3500

Thanks

albertovarela
Partner - Specialist
Partner - Specialist

Hello,

Try this for to sum distinct quotes ~ QuotesValue:

=sum(aggr(distinct QuoteValue,QuoteNumber))

This for OrdersValues:

=sum(OrderValue)

and finally, for the rate of return:

sum(OrderValue) / sum(aggr(distinct QuoteValue,QuoteNumber))

Hope this helps...

jduenyas
Specialist
Specialist
Author

Thanks

That did it.