The first $ in the expression is optional. It says that the modifications we're making are going to start with the CURRENT set of data. The $ indicates the currently-selected set of data, like a 1 indicates the set of ALL data. Since the currently-selected set of data is the default starting point for set analysis, you don't have to explicitly state it with the first $. I leave that $ off, partially because it is easy to confuse with dollar sign expansion, which is a completely different thing.
So I read it about like you, "start with the currently-selected data, then instead of using the ASS_BATCH_ID selection (if any), replace it with a 'selection' of ASS_BATCH_ID_REF, then for that data set, sum all CAP_FTE". I cannot explain how you would get any results if ASS_BATCH_ID is all even numbers, and ASS_BATCH_ID_REF is all odd numbers.
I don't know what the square brackets are doing in the second expression. But I tried it out, and apparently QlikView is happy to interpret them the exact same way as single quotes in this case. I wouldn't use them. I'd use single quotes. I try to put literals in single quotes, field names in double quotes, and table names in brackets. QlikView isn't so strict, but I like having some sort of standards so that I can recognize at a glance what is what.
Thanks very much for your help John.
I'm pleased that my original interpretation was correct, as I was reasonably confident I had understood set analysis before coming across this! I am now comfortable enough with the expression to start poking around in the data to resolve why I'm getting the results that I am.
Like you, I intend to adopt the single quotes/double qoutes/square bracket standards, and knowing that square brackets are interpreted in the same way as single quotes will help me when I have to modify expressions that I've inherited from predecessors.