Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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....
Straight table:
Dimension: item
Exp: Max(If(Pattern1=Pattern2, Pattern2Qty))
Straight table:
Dimension: item
Exp: Max(If(Pattern1=Pattern2, Pattern2Qty))
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)
It seems that I am always over thinking it! Thank you, this worked perfectly.