Skip to content

Latest commit

 

History

History
36 lines (28 loc) · 1.36 KB

using-logical-functions.md

File metadata and controls

36 lines (28 loc) · 1.36 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic ms.custom
Using Logical Functions
Using Logical Functions
kfollis
kfollis
kfollis
02/17/2022
sql
analysis-services
reference
mdx

Using Logical Functions

A logical function performs a logical operation or comparison on objects and expressions and returns a Boolean value. Logical functions are essential in Multidimensional Expressions (MDX) to determine the position of a member.

The most commonly used logical function is the IsEmpty function. For more information on how to use the IsEmpty function, see Working with Empty Values.

The following query shows how to use the IsLeaf and IsAncestor functions:

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]  

See Also

Functions (MDX Syntax)