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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
EMRSD
Contributor
Contributor

Closest Date and return data

This should be simple but I'm learning. I want to be able to search the date column for the closest date to today and then return the corresponding value in the total column. Not a sum of all the values up to that date but just the one value. thanks in advance.

DateTotal
07/03/21336
07/10/21672
07/17/211,007
07/24/211,343
07/31/211,679
08/07/212,015
08/14/212,350
08/21/212,686
08/28/213,022
09/04/213,358
09/11/213,693
09/18/214,029
09/25/214,365
10/02/214,701
Labels (3)
1 Solution

Accepted Solutions
Kushal_Chawda
MVP
MVP

@EMRSD  also try below in text object and where Date is not present as dimension

=FirstSortedValue(distinct Value , mod(Today(1),Date))

View solution in original post

6 Replies
Kushal_Chawda
MVP
MVP

@EMRSD  what will be the preference. closest before today or after today or both?

EMRSD
Contributor
Contributor
Author

Before today. TY

Kushal_Chawda
MVP
MVP

@EMRSD  try below. Make sure that your Date field is  proper date format.

=sum({<Date ={"$(=date(max({<Date={'=div(Today(1),Date)=1'}>}Date)))"}>} Value )

 

Kushal_Chawda
MVP
MVP

@EMRSD  also try below in text object and where Date is not present as dimension

=FirstSortedValue(distinct Value , mod(Today(1),Date))

EMRSD
Contributor
Contributor
Author

This worked. Perfect. thank you very much!

Kushal_Chawda
MVP
MVP

@EMRSD  Accept solution to appropriate reply