Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
patrickbender
Contributor III
Contributor III

Latest datapoint before specific date.

Hi,

I have the following table where i have a lot of data structured like below.

I also have an input field where I specify a year and a month.

I need to be able to find the latest margin before the end of the specified date.

With the below selection i would like to get the margin 3,0%.

If I instead change the month to 10 i would like to get 3,1.

I have experimented with:

FirstSortedValue([SP Marginal], [Målkortsdatum], n)

But this only gives me the nth latest margin.

Is there a way to do this?

DateProjectnumberMargin
2017-12-281233,2%
2017-11-231233,0%
2017-09-151233,1%

YearMonth
201711
1 Reply
marcelviegas
Creator II
Creator II

Hi,

min(aggr(

if(

min({<date={">=$(filterDate)"}>}date)=date,Margin),date))

attachment