I can't see anything that would be obviously wrong with this expression, so the only thing I can offer is some "debugging" directorions:
1. What if you try and add 4 independent expressions with the 4 variables with no IF statements and see if they behave like you expected.
2. With complex expressions, like this one, the Expression syntax checker is usually getting "confused" and it stops identifying errors - any expression appears as "OK".
3. Try to find a way to simplify your expression - after all, you have 2 nested IF statements, with 4 complex expressions with Set Analysis... I wouldn't be surprised if QlikView is getting "confused" with such a complex structure... You can easily avoid at least one "IF" - read my Wiki about using flags. This is perhaps another case of using Flags:
if(UnitDesc='Debt and Treasury Technology', <expr1>, <expr2>),
you can calculate a flag - let's call it DTT_Flag that will have 1 when your condition is true and 0 if it's false. Then, your expression could look like:
I'm not sure what's causing the problem in your case. It's hard to guess without looking at the whole picture.
If anything else looks absolutely accurate,
and all 4 individual expressions without IF statements work as expected,
and they only stop working when combined with IF statements
then the logical conclusion is that QlikView didn't like the combination of nested IFs with the Set Analysis expressions inside. If that's the conclusion (again, I'm not sure it is because I can't see your app), - then you can at least avoid one IF by replacing it with the flag:
In your load script, in the table that holds UnitDesc, add a flag as following:
IF(UnitDesc = 'Debt and Treasury Technology' , 1, 0) as DTT_Flag
In your expression, replace the IF by the Flag, like this:
It's strange because I broke the problem down into parts and it seemed to work.
The graph I had, had an option on the x-axis to switch between a monthly view or a view over the past twelve weeks. I can create two separate graphs where one has the monthly view and one has the weekly view. Each works and is unaffected by date selection(set analysis working). However, when I use the if condition so that the two graphs work as one, the set analysis doesn't work.
I'm at a loss as to why this is happening....Any other thoughts?
This does indeed work but the set analysis does not seem to work, ie when a date is selected only one column shows..I would like this to show the same figures regardless of date selection (as it is a trending graph over time).