Problem with CoalesceEmpty -
09-09-2005
, 01:01 AM
Hi,
I am having a nightmare with this inventory scenario.
Seemingly simple. All I am trying to do is find a "Last Non Empty
Balance". I've read the microsoft paper and just about everything else
I can find but I'm still stuck.
I have the following formula for "Last Non Empty Value"
CoalesceEmpty((Measures.[IC Close OnHand Qty], [Sales
Period].currentmember) ,
(Measures.[Last Non Empty Value],[Sales
Period].CurrentMember.PrevMember))
which works great in some instances. In some cases however AS returns a
"Internal Error". I think this is because there is no balance at all
for some products and the reference to "prevmember" fails.
At which I thought that rather than simply call itself with prevmember
i should check first ie.
CoalesceEmpty((Measures.[IC Close OnHand Qty], [Sales
Period].currentmember) ,
iif([Sales Period].currentmember is head([Sales
Period].currentmember.level.members).item(0),0,
(Measures.[Last Non Empty Value],[Sales
Period].CurrentMember.PrevMember)))
Which had no affect at all.
I also have "NON EMPTY" in my query so then I though it might be that
the check for first is wrong because the first member available is not
necessarily the first on that level because some members have been
eliminated.
If so, how do I do this check.
Note that if I force an first 0 entry for every products, it all seems
to work fine, but I don't want to do this because of the volume.
Any help gratefully received!!
Thanks.
What am I doing wrong? |