Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

joshmartyne
New Contributor II

Most recent date using input date variable

Hi,

I have an app that wishes to present comparison data of two dates (present and a selected date in the past). The user can select the date which is then recorded as vInputDate. I now need to work out the logic to display the correct data line.


A simplified dataset would be:


Project NameData entry dateData
Project A01/08/20171234
Project A01/09/20174123
Project A01/10/20173412
Project B01/08/2017ABCD
Project B01/09/2017BCDA
Project B01/10/2017CDAB

So if the user selected 10/09/2017, the (fully working) app should display Project A: 4123 and Project B: BCDA, however with my current code (below) it also shows results for 01/08/2017.

=if([Data entry date]<=vInputDate,[Data])

Any advice on how I could execute this would be much appreciated.

Thanks

Tags (1)
2 Replies

Re: Most recent date using input date variable

May be with Set analysis

Only({<[Data entry date] = {$(=Date(vInputDate, 'DD/MM/YYYY'))}>}Data)

pradosh_thakur
Honored Contributor II

Re: Most recent date using input date variable

what about

=if(fabs(vInputDate-[Data entry date])=fabs(min(vInputDate-[Data entry date])),[Data])

Learning never stops.
Community Browser