Look carefully, you will find that they don't do the same thing. They may return the same result but they simply don't do the same thing.
If they're returning the same result then it means one or more of the criteria has already been catered for in the steps I gave you earlier. Or your data just doesn't require one of them.
Yes you are right, they don't do the same thing (I just said that they returned the same result).
But as MyValue = 0 when IsNull([UK_Working days].[Calendar date])=True
I think that:
The first solution fills what's before Date() then fills the 0 when IsNull.. then fills the values
The second solution fills what's before Date() and what's after with some 0 (=Myvalue when CalDate>Date()) when IsNull, then fills the values not = 0 after Date()
IIf([Calendar_All Dates].[Calendar date]<Date(),
[MyValue],
IIf(IsNull([UK_Working days].[Calendar date])=True,0,(SELECT [MyValue] FROM [Query222])))
MyValue will show if the Calendar Date is before today. Otherwise, if there's no calendar date it will show 0, and as a last resort, if everything else fails it will show the last value.
Code:
IIf([Calendar_All Dates].[Calendar date]<Date() or IsNull([UK_Working days].[Calendar date])=True,
[MyValue],
(SELECT [MyValue] FROM [Query222]))
MyValue will ONLY show if there is no calendar date or the calendar date is before today. Otherwise, if none of those conditions are met, show the highest value.
IIF() is like a real life scenario. If I do this what will happen? On the other hand if I don't do it, what will happen? I do = True, I don't do = False.