The purpose of this code snippet is to provide the user a default view if no selection was made. GetSelectedCount is a very useful function but it made the code a bit more complex. E.g. the main reason of the surrounding if-condition is, that I'm not able to tell qlik that it should take all months less than month today.
which avoids the doubled calculation through the if-loop (all branches of an if-loop will always be calculated) and further the concat-aggregations within set analysis which without a DISTINCT might return a very large data-set.
As you can see I've changed the second getselectedcount into YEAR. Now, it shows the entire year if no year was selected. But it ignores any month selection for the current year as long as the user doesn't select a year.