Run Sql Statement on any date reterive laste date of previous fiscal year June

Hi Experts !
I required your help , I need to get the last date of fiscal year previous which is June 30. if I run on 3-Aug-19 retrieve the previous fiscal year end date which is 30-June-2019.

Something like this?

Declare @currentDate datetime = '2019-07-29';
 Select datefromparts(year(@currentDate) + iif(month(@currentDate) < 7, -1, 0), 6, 30);

Jeff exactly thank you very much !

You are welcome - happy to help.