Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor
Contributor

Minimum among previous

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

1 Solution

Accepted Solutions
Highlighted

Re: Minimum among previous

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;


Capture.PNG


View solution in original post

3 Replies
Highlighted
Partner
Partner

Re: Minimum among previous

What is the logic behind calculating Min?

Highlighted

Re: Minimum among previous

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;


Capture.PNG


View solution in original post

Highlighted
Contributor
Contributor

Re: Minimum among previous

It works!

Thank you!