# Qlik Sense App Development

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for
Did you mean:
Highlighted
Contributor

## Minimum among previous

Hi!

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?

1 Solution

Accepted Solutions
Highlighted
MVP

May be this

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

];

FinalTable:

If(Letter = Previous(Letter), RangeMin(Peek('Min'), PeekedNumber)) as Min;

If(Letter = Previous(Letter), Peek('Number')) as PeekedNumber

Resident Table

Order By Letter, date;

DROP Table Table;

DROP Field PeekedNumber;

3 Replies
Highlighted
Partner

What is the logic behind calculating Min?

Highlighted
MVP

May be this

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

];

FinalTable:

If(Letter = Previous(Letter), RangeMin(Peek('Min'), PeekedNumber)) as Min;

If(Letter = Previous(Letter), Peek('Number')) as PeekedNumber

Resident Table

Order By Letter, date;

DROP Table Table;

DROP Field PeekedNumber;

Highlighted
Contributor

It works!

Thank you!