Code below will work with any DATEFIRST setting and does not require a loop. I use a CROSS APPLY just to assign a name to the date calc -- you could instead just repeat the expression in the main code, as the second code block shows.
--more "self-documented" code
SELECT
user_date_entered,
/* back up next years max possible date to the last Friday */
DATEADD(DAY, -(DATEDIFF(DAY, Friday, prev_year_max_date) % 7), prev_year_max_date) AS last_years_Fri_date
FROM (
VALUES('20160916'),('20160909'),
('20160910'),/*test a Saturday input date to verify the code always returns Friday*/
('20160911'),/*test a Sunday input date to verify the code always returns Friday*/
('20160912')/*test a Monday input date to verify the code always returns Friday*/
) AS test_data(user_date_entered)
CROSS APPLY (
/*push the date forward 6 days so we can "back up" to Friday*/
SELECT 4 AS Friday, DATEADD(DAY, +6, DATEADD(YEAR, -1, user_date_entered)) AS prev_year_max_date
) AS assign_alias_names
--minimum amount of code
SELECT
user_date_entered,
DATEADD(DAY, -(DATEDIFF(DAY, 4,DATEADD(DAY, +6, DATEADD(YEAR, -1, user_date_entered))) % 7),
DATEADD(DAY, +6, DATEADD(YEAR, -1, user_date_entered))) AS last_years_Fri_date
FROM (
VALUES('20160916'),('20160909'),
('20160910'),/*test a Saturday input date to verify the code always returns Friday*/
('20160911'),/*test a Sunday input date to verify the code always returns Friday*/
('20160912')/*test a Monday input date to verify the code always returns Friday*/
) AS test_data(user_date_entered)
Open in new window
Just replace GETDATE() with a different date to get the Friday of that week.