Za pomocą funkcji logicznych
Funkcja logiczna wykonuje operację logiczną lub porównanie obiektów i wyrażeń i zwraca wartość typu wartość logiczna.Funkcje logiczne są istotne w wyrażeniach MDX (Multidimensional) aby ustalić pozycję element członkowski.
Najczęściej używanych funkcja logicznych jest IsEmpty funkcja.Więcej informacji na temat sposobów korzystania z IsEmpty funkcja, zobacz Praca z wartości puste.
Następująca kwerenda pokazuje, jak użyć IsLeaf i IsAncestor funkcji:
WITH
//Returns true if the CurrentMember on Calendar is a leaf member, ie it has no children
MEMBER MEASURES.[IsLeafDemo] AS IsLeaf([Date].[Calendar].CurrentMember)
//Returns true if the CurrentMember on Calendar is an Ancestor of July 1st 2001
MEMBER MEASURES.[IsAncestorDemo] AS IsAncestor([Date].[Calendar].CurrentMember, [Date].[Calendar].[Date].&[1])
SELECT{MEASURES.[IsLeafDemo],MEASURES.[IsAncestorDemo] } ON 0,
[Date].[Calendar].MEMBERS ON 1
FROM [Adventure Works]