Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Black_Hole
Creator II
Creator II

Compare two value

Hello all,

I am trying to affect the value "type" of the maximum sum by invoice.

To illustrate this idea, below an example:

Invoice num | Type | Amount

INV123            | S         | 0

INV123            | F         | 3 500

INV567            | S         | 1 500

INV567            | F         | 500

----> Result expected:

Invoice num | Type | Amount

INV123            | F         | 3 500

INV567            | S         | 2 000

 

Please could you help me to resolve this?

Many thanks in advance for your help.

 

Labels (2)
1 Solution

Accepted Solutions
Taoufiq_Zarra

@Black_Hole 

May be :

Data:

load * inline [
Invoice num | Type | Amount

INV123            | S         | 0

INV123            | F         | 3500

INV567            | S         | 1500

INV567            | F         | 500
](delimiter is '|');

output:
noconcatenate

load [Invoice num], FirstSortedValue(Type,-Amount) as Type,sum(Amount) as Amount resident Data group by [Invoice num];

drop table Data;

 

Capture.PNG

 

attached qvw file

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

2 Replies
Taoufiq_Zarra

@Black_Hole 

May be :

Data:

load * inline [
Invoice num | Type | Amount

INV123            | S         | 0

INV123            | F         | 3500

INV567            | S         | 1500

INV567            | F         | 500
](delimiter is '|');

output:
noconcatenate

load [Invoice num], FirstSortedValue(Type,-Amount) as Type,sum(Amount) as Amount resident Data group by [Invoice num];

drop table Data;

 

Capture.PNG

 

attached qvw file

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Black_Hole
Creator II
Creator II
Author

Hello @Taoufiq_Zarra ,

Excellent !! Your solution works as expected.

Thanks a lot for your help.