Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

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

2 Replies
Highlighted

May be with Set analysis

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

Highlighted
Master II
Master II

what about

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

Learning never stops.