Matching dates with conditions and filtering in a table
I think what you want to do is rank the data based upon the smallest difference between the dates, per year - but you only need to consider any rows where date1 is greater that date2. For this, I would personally use a CTE to filter and rank the results before returning it like so:

WITH results
AS(
  SELECT id, date1, date2, value
       , RANK() OVER (PARTITION BY id, date1 
                ORDER BY DATEDIFF(DAY, date1, date2) DESC) AS rnk
    FROM tblA
   WHERE date1 &gt;= date2
)
SELECT DISTINCT id, date1, date2, value
  FROM results
 WHERE rnk = 1;


You can find the results on dbfiddle.

For more information see the official documentation of RANK and CTE.