Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
sbfernandes
Contributor III
Contributor III

Find the date (column 1) corresponding to the closest higher or same (>=) value (column 2)

Greetings

I have a table with two columns: Date and Cumulative Value.

From the below calculations, 1 get 4 numbers:

max(Cumulative Value) *(1/4), 

max(Cumulative Value) *(2/4), 

max(Cumulative Value) *(3/4) and 

max(Cumulative Value) *(4/4)

I get 4 values.

I now want to get the date corresponding to the closest to these values from the table. The closest value must be greater than or equal to numbers

Eg:

DateCumulative Value
01/01/202032
09/01/202070
10/02/202095
14/02/202099
19/02/2020100
20/02/2020115
23/02/2020123
05/03/2020164
07/03/2020188
11/03/2020189
16/03/2020201

 

Find date that corresponds closest to value without being lower (>=)

numbers50.25100.5150.75201
Closest Value  from table (>=)70115164201
FINAL OUTPUT: Date that corresponds to Closest Value09/01/202020/02/202005/03/202016/03/2020

 

Thank you.

Labels (2)
2 Solutions

Accepted Solutions
tresesco
MVP
MVP

Try like:

=Only({<[Cumulative Value]={'$(=
Min({<[Cumulative Value]={">=$(=max([Cumulative Value])*(1/4))"}>} [Cumulative Value])
)'}>}
Date)

 

For various other values, you have to replace the highlighted portion.

View solution in original post

tresesco
MVP
MVP

Wait, I got an easier expression.

=FirstSortedValue(Date,If([Cumulative Value]>=$(=max([Cumulative Value])*(1/4)), [Cumulative Value]))

View solution in original post

3 Replies
tresesco
MVP
MVP

Try like:

=Only({<[Cumulative Value]={'$(=
Min({<[Cumulative Value]={">=$(=max([Cumulative Value])*(1/4))"}>} [Cumulative Value])
)'}>}
Date)

 

For various other values, you have to replace the highlighted portion.

tresesco
MVP
MVP

Wait, I got an easier expression.

=FirstSortedValue(Date,If([Cumulative Value]>=$(=max([Cumulative Value])*(1/4)), [Cumulative Value]))

sbfernandes
Contributor III
Contributor III
Author

Hi Tresesco

Many thanks for the quick response. Both expressions work fine.