Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi!
I really need your help
For examle I have a table:
[Letter, Number, date
aaa,5,9
bbb,4,9
aaa,7,10
bbb,3,10
aaa,1,12
bbb,3,12
aaa,6,13]
For each letter I need to get a minimum among previous days
So it would be:
[Letter, Number, date, Min
aaa,5,9, -
bbb,4,9, -
aaa,7,10, 5
bbb,3,10, 4
aaa,1,12, 5
bbb,3,12, 3
aaa,6,13, 1]
How can I do that?
Thanks in advance
May be this
Table:
LOAD * INLINE [
Letter, Number, date
aaa, 5, 9
bbb, 4, 9
aaa, 7, 10
bbb, 3, 10
aaa, 1, 12
bbb, 3, 12
aaa, 6, 13
];
FinalTable:
LOAD *,
If(Letter = Previous(Letter), RangeMin(Peek('Min'), PeekedNumber)) as Min;
LOAD *,
If(Letter = Previous(Letter), Peek('Number')) as PeekedNumber
Resident Table
Order By Letter, date;
DROP Table Table;
DROP Field PeekedNumber;
What is the logic behind calculating Min?
May be this
Table:
LOAD * INLINE [
Letter, Number, date
aaa, 5, 9
bbb, 4, 9
aaa, 7, 10
bbb, 3, 10
aaa, 1, 12
bbb, 3, 12
aaa, 6, 13
];
FinalTable:
LOAD *,
If(Letter = Previous(Letter), RangeMin(Peek('Min'), PeekedNumber)) as Min;
LOAD *,
If(Letter = Previous(Letter), Peek('Number')) as PeekedNumber
Resident Table
Order By Letter, date;
DROP Table Table;
DROP Field PeekedNumber;
It works!
Thank you!