Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Last() function

I am trying to pull values into a straight table using the Last() function. Capture.JPG

This is what my table looks like now, however the dates are incorrect. I need to pull in the last promise date and last delivery dates for each of the values on the left. All of the numbers on the left have different lives, so some go from, for example, March to April, or possibly May14-20, or May through June 15. The timeline of the left numbers vary greatly.

The data is loaded into Qlikview using many different Excel files and many load statements, otherwise I would use LastValue(), although that might end up being the easiest way to do this.

1 Solution

Accepted Solutions
Not applicable
Author

I tried max() and it gives me the highest value, not the last value. I just tried Aggr(FirstSortedValue(,-[Date]),[Sales Doc. & Line No.] which works better.

View solution in original post

5 Replies
marcus_sommer

You need for this firstsortedvalue([Latest Promise Date], -[Latest Promise Date]).

- Marcus

Not applicable
Author

I tried that but it only worked for the sales doc #s that only had one promise date and one delivery date inputted, the rest came up null.

marcus_sommer

Yes, firstsortedvalue() had the limitation that it only worked if the rank-place is unique - sometimes you could adjust this with a set analysis within the expression but I think you should max() give a try:

date(max([Latest Promise Date]), 'MM/DD/YYYY')

And last() is a inter-record function and isn't suitable for this then it's only for pivot-tables available and inter-record function calculates in context to other rows and columns within the pivot and not against the dataset itself.

- Marcus

sunilkumarqv
Specialist II
Specialist II

Use peek Function to get last field

In script .

Let vLastvalue =  Peek('FieldName',-1,'TableName');


or


date(maxstring([Latest Promise Date]), 'MM/DD/YYYY')

Not applicable
Author

I tried max() and it gives me the highest value, not the last value. I just tried Aggr(FirstSortedValue(,-[Date]),[Sales Doc. & Line No.] which works better.