When you're using dates that look like Jul-Dec 2008, QlikView thinks it is text. We use the dual to assign a number to the text so that QlikView will treat it like a number. The second portion of your if statement that deals with a date, casts the value as a date, which QlikView already treats like a dual (text with a numeric value behind it).
I think you can prepare the two dimensions in your script and then just switch dimensions using your variable, but it should also work as is using a dual value and a numeric sort option:
dual('Jan-Jun '&Year([Date]),yearstart([Date]) ),
dual('Jul-Dec '&Year([Date]),yearstart([Date],0,7) ),