Skip to main content
Announcements
Announcing Qlik Talend® Cloud and Qlik Answers™ to accelerate AI adoption! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with chart expression

I am looking for some advice on the following scenario:

LOAD * INLINE [
Item, Pattern1, Pattern2, Pattern2Qty
A, 1, 1, 100
A, 1, 1, 150
A, 1, 2, 125
A, 1, 2, 200
A, 1, 2, 250
B, 2, 1, 50
B, 2, 1, 300
B, 2, 2, 150
B, 2, 2, 200
]
;

I am looking for the Max of Pattern2Qty (grouped by Item), where Pattern1 = Pattern2. The result should look like this..

A   150

B   200

Thank you for taking the time to help me....

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Straight table:

Dimension: item

Exp:  Max(If(Pattern1=Pattern2, Pattern2Qty))

Capture.PNG

View solution in original post

3 Replies
tresesco
MVP
MVP

Straight table:

Dimension: item

Exp:  Max(If(Pattern1=Pattern2, Pattern2Qty))

Capture.PNG

sunny_talwar

Or may be create a flag in the script

LOAD *,

    If(Pattern1 = Pattern2, 1, 0) as Flag

LOAD * INLINE [
Item, Pattern1, Pattern2, Pattern2Qty
A, 1, 1, 100
A, 1, 1, 150
A, 1, 2, 125
A, 1, 2, 200
A, 1, 2, 250
B, 2, 1, 50
B, 2, 1, 300
B, 2, 2, 150
B, 2, 2, 200
];

and then this

Max({<Flag = {1}>} Pattern2Qty)

Not applicable
Author

It seems that I am always over thinking it!  Thank you, this worked perfectly.