Exists Function – MDX Query


In MDX query is we want to find that particular set or tuples exists in the given second set ,we can use this function
If we provide optional measure group then it will also check the tuples has non NULL data in that measure group

Exists( Set_Expression1 , Set_Expression2 [, MeasureGroupName] )

Examples

Here in this example if the year value is between 2003 to 2004 we want to show Inside else we want to show Outside.
So we have to check that every year value is between 2003 and 2004 or not.

with member [Measures].[test]
as
iif(isempty((exists ([Date].[Fiscal].currentmember,{[Date].[Fiscal].
[Fiscal Year].&[2003]:[Date].[Fiscal].[Fiscal Year].&[2004]}).item(0),
[Measures].[Internet Sales Amount])),”Outside”,”inside”)

select {[Measures].[Internet Sales Amount], [Measures].[test]} on 0 ,
[Date].[Fiscal].[Fiscal Year] on 1
from
[Adventure Works]

Leave a comment


Design a site like this with WordPress.com
Get started