Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
johnca
Specialist
Specialist

Need Last Value

Here's an easy one, but to me it's not so easy <sigh>, especially when the boss needs it yesterday.
I have ship data where a widget can ship and be returned and ship again. My issue is, I need to find the last time a widget shipped prior to a certain date (got this part). I was able to add a count number to each record as shown in the table below, but can't seem to eliminate all but the highest counter, or latest date. I was hoping to find something like LastSortedValue, but alas...not to be.
Widget SerNoShip DateCounter
11/1/20111
14/4/20112
21/2/20111
33/5/20111
42/1/20111
44/1/20112
51/1/20111
52/1/20112
53/1/20113
63/5/20111
I need my data to look like this:
Widget SerNoShip DateCounter
14/4/20112
21/2/20111
33/5/20111
44/1/20112
53/1/20113
63/5/20111

Thanks,

John

1 Solution

Accepted Solutions
danielrozental
Master II
Master II

You can use firstsortedvalue with a reversed order.

Ship date expression would be, firstsortedvalue([Ship date],-[Ship date]) and counter firstsortedvalue(Counter,-[Ship date]).

View solution in original post

4 Replies
danielrozental
Master II
Master II

You can use firstsortedvalue with a reversed order.

Ship date expression would be, firstsortedvalue([Ship date],-[Ship date]) and counter firstsortedvalue(Counter,-[Ship date]).

er_mohit
Master II
Master II

use this function

-firstsorted value function.

it gives you last value..

johnca
Specialist
Specialist
Author

I had a feeling it would be FirstSortedValue-something-or-other. I see the '-' sign designates the last record rather than the first record...perfect.

Thanks Daniel

johnca
Specialist
Specialist
Author

This seems to return a negative value of what I'm seeking, date or counter.