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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Get a value in a certain date

In my Qlik application I define two variables: startInvDate and finishInvDate, where the first is the date when an investment starts and the last is the date when it finishes.


I also have some stocks and their AdjClose for each Date, for example:

DateEquityAdj Close
2016-04-01YHOO36.48
2016-03-31YHOO36.81
2016-03-30YHOO36.56
2016-03-29YHOO36.32
2016-03-28IBM148.4
2016-03-29IBM149.33
2016-03-30IBM148.41
2016-03-31IBM151.45

My target is to get the adj Close for finishInvDate variable for each stock. I tried:

=FirstSortedValue([Adj Close],Date)

to get the last Adj Close of a selected Date, but it does not work properly.

2 Replies
sunny_talwar

What is the expected output from the above sample?

sunny_talwar

To get the most recent Adj Close, you need to add a negative sign before date:

=FirstSortedValue([Adj Close], -Date)

or this:

=FirstSortedValue({<Date = {"$(='<=' & Date(Max(Date)))"}>}[Adj Close], -Date)