I am not a specialist for Pentaho/Mondrian, but I would assume the issue is that in your second scenario, the [Product].CurrentMember
is the all member of the products, not the Food
member, and thus the system behaves as you told it, and returns 0.
From how I understand your question, something like
IIf(
Count(
Intersect(
{ [Product].CurrentMember },
{ [Product].[Food], [Product].[Drink], [Product].[All] }
)
) = 1
AND
Count(
Intersect(
{ [Country].CurrentMember },
{ [Country].[US], [Country].[DE], [Country].[All] }
)
) = 0
[Unit Sales],
0
)
should deliver what you want. The trick here is that the intersection between the one-element set containing the CurrentMember
and another set can either have one element - in case the CurrentMember
is contained in the set -, or zero elements - in case the element is not contained in the set.