How are you determining what yyyy is? Is there a particular reason why you need a variable and can't just use the results of a formula?
Assuming you're looking for the year of the current date and that "the selected date" is entered by the user, try this (no variable needed...):
1. In the Field Explorer, create a date parameter called "Selected Date"
2. Your formula will look like this:
if {?Selected Date} >= Date(Year(currentdate), 10, 1) then
Date(Year(currentdate), 9, 30)
else
Date(Year(currentdate)-1, 9, 30)
-Dell