共用方式為


使用邏輯函數

邏輯函數可對物件及運算式執行邏輯作業或比較,然後傳回布林值。多維度運算式 (MDX) 中必須要有邏輯函數,才能判斷成員的位置。

最常使用的邏輯函數是 IsEmpty 函數。如需有關如何使用 IsEmpty 函數的詳細資訊,請參閱<使用空白值>。

下列查詢會示範如何使用 IsLeaf 和 IsAncestor 函數:

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]

請參閱

概念