Olap Universe

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

OLAP universes best practices

Author: Didier MAZOUÉ

December 2009

Version 1.5

Table of Contents
1 Introduction ..........................................................................................................................2
2 MDX Functions ....................................................................................................................3
2.1 Remarks and comments ...............................................................................................3
2.2 Samples and definition: SAP and Microsoft...................................................................3
2.3 SAP and Microsoft validation tests ................................................................................4
3 Calculated measures ...........................................................................................................6
3.1 Definition .......................................................................................................................6
3.2 Recommendations ........................................................................................................6
3.3 Use calculated measures in pre-defined filters ..............................................................6
3.4 Samples........................................................................................................................7
4 Universe pre-defined filters ..................................................................................................9
4.1 Filter operators..............................................................................................................9
4.2 Samples........................................................................................................................9
4.3 Other samples ............................................................................................................12
5 When using universe @functions .......................................................................................14
5.1 Using @Select function ...............................................................................................14
5.2 Using @Prompt function .............................................................................................14
5.3 Samples......................................................................................................................15
1 Introduction

XI R3.0 has been released in Q4 2007 with a high priority on OLAP data sources and especially
on Netweaver BI.
Many people are very familiar with the Semantic Layer on relational data sources but have not
the same skill level on OLAP data.

This document aims to provide a list of best practices and especially on how to enrich an OLAP
universe.
This document is especially focusing on SAP Netweaver BI and Microsoft Analysis Services.

This document will cover the following items:


Provide a list of “some” useful MDX functions
How to use MDX in calculated measures for SAP Netweaver and Microsoft Analyis
Services
List the different types of pre-defined filter in OLAP universes
Use @Select and @Prompt in OLAP universes metadata
Provide recommendations, best practices and limitations if any.
2 MDX Functions

2.1 Remarks and comments

SAP Netweaver BI:


Calculated measures must return numeric values
Some limitations especially with time series functions
MDX version supported is closed to MSAS 2000
Tested on SAP BW 3.0, SAP BW 3.5 and SAP Netweaver BI 7.

2.2 Samples and definition: SAP and Microsoft

Function SAP Netweaver MSAS 2005 and 2008


Aggregate Aggregate({ Aggregate({[Date].[Calendar].[Month]
[Z_ORDERD].[20040110]:[Z_ORDERD].[2 .&[2002]&[2]:[Date].[Calendar].[Mont
0040124] }, [Measures].[Z_ORDER]) h].&[2003]&[10] },
[Measures].[Internet Sales Amount])
Rank on Rank([0CALMONTH].CurrentMember, Rank([Date].[Calendar].CurrentMember
measure Order([0CALMONTH].CurrentMember.Lev ,Order([Date].[Calendar].CurrentMemb
el.Members [Measures].[0D_INV_QTY], er.Level.Members ,
BDESC) ) [Measures].[Internet Sales Amount],
BDESC) )
Rank Rank([0CALMONTH].CurrentMember, Rank([Date].[Calendar].CurrentMember
members [0CALMONTH].CurrentMember.Level.Mem ,[Date].[Calendar].CurrentMember.Lev
bers) el.Members)
Variance ([Measures].[0D_INV_QTY] - ([Measures].[ Internet Sales Amount]
([Measures].[0D_INV_QTY], - ([Measures].[Internet Sales
[0CALMONTH].PrevMember)) / Amount],
([Measures].[0D_INV_QTY], [Date].[Calendar].PrevMember)) /
[0CALMONTH].PrevMember) ([Measures].[Internet Sales Amount],
[Date].[Calendar].PrevMember)
Weight [Measures].[0D_INV_QTY] / [Measures].[Internet Sales Amount] /
([Measures].[0D_INV_QTY], ([Measures].[Internet Sales Amount],
[0CALMONTH].Parent) [Date].[Calendar].Parent)
Year To Date SUM(YTD([0CALMONTH].CurrentMember), SUM(YTD([Date].[Calendar].CurrentMem
[Measures].[0D_INV_QTY])) ber), [Measures].[Internet Sales
Amount]))
It is important to notice that YTD (as well as QTD,
MTD, WTD, etc) requires a reference to a It is important to notice that YTD (as well as QTD,
predefined characteristic such as 0CALYEAR, MTD, WTD, etc) requires a reference to a dimension
0CALQUARTER, 0CALMONTH, 0CALDAY or tagged as Time.
0CALWEEK. Moreover, the selected time dimension must also
Moreover, the selected characteristic must also be included in the query results
be included in the query results.
Previous ([Measures].[0D_INV_QTY], ([Measures].[Internet Sales Amount],
Member [0CALMONTH].PrevMember) [Date].[Calendar].PrevMember)
Members IIf([OCALMONTH].CurrentMember.Name IIf([Date].[Calendar].CurrentMember.
range for a >= Name >=
given parent [OCALMONTH].CurrentMember.FirstSibl [Date].[Calendar].CurrentMember.Firs
ing.Lead(2)).Name and tSibling.Lead(2)).Name and
[OCALMONTH].CurrentMember.Name <= [Date].[Calendar].CurrentMember.Name
[OCALMONTH].CurrentMember.FirstSibl <=
ing.Lead(5).Name,0,1) [Date].[Calendar].CurrentMember.Firs
tSibling.Lead(5).Name,0,1)
Filtered (([Measures].[0D_INV_QTY], (([Measures]. [Internet Sales
measure / [0CALQUARTER].[19981], Amount], [Date].[Calendar].[Calendar
Restricted [0D_DIV].[7]) Quarter].&[2003]&[1],
[Product].[Product
key figure:
Categories].[Category].&[4])
Single
member
Filtered Aggregate([0CALQUARTER].[19981]: Aggregate([Date].[Calendar].[Calenda
measure / [0CALQUARTER].[19983], r Quarter].&[2003]&[1]:
Restricted [Measures].[0D_INV_QTY]) [Date].[Calendar].[Calendar
Quarter].&[2003]&[3], [Measures].
key figure:
[Internet Sales Amount])
Include range
of members
Filtered Aggregate(Except([0CALQUARTER].Memb Aggregate(Except([Date].[Calendar].[
measure / ers, [0CALQUARTER].[19981]: Calendar Quarter].Members,
Restricted [0CALQUARTER].[19983]), [Date].[Calendar].[Calendar
[Measures].[0D_INV_QTY]) Quarter].&[2003]&[1]:
key figure: [Date].[Calendar].[Calendar
Exclude Quarter].&[2003]&[3]), [Measures].
range of [Internet Sales Amount])
members
Standard Stddev({[0CALQUARTER].[19983], Stdev({[Date].[Calendar].[Month].[Ja
deviation [0CALQUARTER].[19982], nuary
[0CALQUARTER].[19981]},[Measures].[ 2003],[Date].[Calendar].[Month].[Feb
0D_INV_QTY]) ruary
2003],[Date].[Calendar].[Month].[Mar
ch 2003]},[Measures].[Internet Order
Quantity])
Count Count([0CALYEAR].Members) Count([Date].[Calendar].Members)
members of a
Dimension / Count([0CALYEAR].[LEVEL01].Members) Count([Date].[Calendar].[Quarter].Me
mbers)
Hierarchy /
Level
Default [0CALYEAR].DefaultMember [Date].[Calendar].DefaultMember.Name
Member
User name: username
User connected
on the OLAP
server

2.3 SAP and Microsoft validation tests

Function SAP Netweaver MSAS 2005 and 2008


Aggregate OK OK
Rank on measure OK OK
Rank members OK OK
Variance OK OK
Weight OK OK
Year to Date OK / Error: works only if Time OK
dimension defined
Previous Member OK OK
Members range OK OK
for a given parent
Filtered measure OK OK
Standard OK OK
deviation
Count members of OK OK
a Dimension /
Hierarchy / Level
Default Member KO: only numeric values are allowed as OK
result for calculated measures
User name Unsupported OK

For more information about MDX functions please have a look on the following link:
http://msdn2.microsoft.com/en-us/library/ms145970.aspx
3 Calculated measures

3.1 Definition

To define a Calculated Measure, users must create manually new Measures in the Universe.
Calculated Measures definitions are using MDX functions embedded in XML tags.

In order to create calculated measures, users must to create pure MDX expression embedded
in XML tags: <EXPRESSION></EXPRESSION>
In this new expression, we authorize to use any Designer function such as:
@Select
@Prompt
@Variable
The check integrity will validate the XML syntax and any of the Designer functions described
above.
No MDX parser is provided in this version of Universe Designer

This paragraph describes how to define calculated measures in MDX and using @Select and
@Prompt functions

3.2 Recommendations

We recommend using @Select as much as possible rather than the Measure definition for
multiple reasons:
@SELECT is always resolved at query time
Life Cycle Management only ensure integrity with generated objects not with objects
created by a user: @Select always guarantee the validity of the object
Check Integrity will only validate:
o XML tags
o Designer @Function
o Objects that reference Levels, Level Attributes or Measures only

3.3 Use calculated measures in pre-defined filters

A calculated measure can be used in a pre-defined filter.


The expression can be embedded in the filter definition ore referenced by using an @Select
function.
In such a case the filter definition must be as following:
<FILTER EXPRESSION="@Select(Class\Object)">
<FILTER EXPRESSION="IIF([Measures].[Quantity] = 2000, 1, 0)">

Moreover you have to encode special characters in the calculated expression in order to have
the XML to be parsed correctly: this is due to a bug that will be fixed after Mira.
Example:
Calculated measure definition that can be Calculated measure definition that can
used in a result set be used in a filter
<EXPRESSION>IIF(CDate([Time].CurrentMembe <FILTER EXPRESSION="
r.MemberValue > CDate(“2006/01/01”), 1, IIF(CDate([Time].CurrentMember.Memb
0)</EXPRESSION> erValue &gt;
CDate(&quot;2006/01/01&quot;), 1,
0)"><CONDITION
OPERATORCONDITION="Equal"><CONSTANT
CAPTION="1"/></CONDITION></FILTER>

Here is a list of characters that must be encoded to be used in filters:


Character Encoding
& &amp;
< &lt;
> &gt;
“ &quot;
‘ &apos;

3.4 Samples

Calculated Universe definition Comments


measure
samples
Aggregate <EXPRESSION>Aggregate({ Invoke “Order Amount” measure
[Z_ORDERD].[20040110]:[Z_ORDERD].[2004012 definition
4] }, @Select(Key Figures\Order Amount)
)</EXPRESSION>
Rolling aggregate <EXPRESSION>Aggregate( { Invoke “Reseller Sales Amount”
[Date].[Calendar].CurrentMember:[Date].[C measure definition.
alendar].CurrentMember.lead(@Prompt('Numb
er of periods','N',,mono,free))}, Prompt user to select the number of
@Select(Measures\Reseller Sales Amount) periods starting from the current
)</EXPRESSION> member for the aggregate function: if
the value is positive then the
aggregation will take into account
next members on the current
hierarchy level.

Top/Bottom on <EXPRESSION>Rank([0CALMONTH].CurrentMembe Invoke “Billed quantity” measure


measure r, definition.
Order([0CALMONTH].CurrentMember.Level.Mem
bers @Select(Key Figures\Billed Prompt user to select Top or Bottom
Quantity), B@Prompt(‘Top or parameter: BDESC is for Top and
Bottom’,’N’,{‘DESC’,’ASC’},mono,constrain BASC is for bottom.
ed,,{‘DESC’}) ) )</EXPRESSION>
Variance <EXPRESSION>(@Select(Key Figures\Billed Invoke “Billed quantity” measure
Quantity) - (@Select(Key Figures\Billed definition.
Quantity), [0CALMONTH].PrevMember)) /
(@Select(Key Figures\Billed Quantity),
[0CALMONTH].PrevMember)</EXPRESSION>
Weight <EXPRESSION>@Select(Key Figures\Billed Invoke “Billed quantity” measure
Quantity) / (@Select(Key Figures\Billed definition.
Quantity),
[0CALMONTH].Parent)</EXPRESSION>
Year To Date <EXPRESSION>SUM(YTD(@Select(Key Invoke “Billed quantity” measure
Figures\Billed Quantity)))</EXPRESSION> definition.
Period To Date <EXPRESSION>SUM(@Prompt(‘Period to Invoke “Billed quantity” measure
date?’,N’,{‘YTD’,’QTD’,’MTD’,’WTD’},mono, definition.
constrained)(@Select(Key Figures\Billed
Quantity)))</EXPRESSION> Prompt user to select which “period
to date” to choose: YTD, QTD, MTD,
WTD
Measure on <EXPRESSION>(@Select(Key Figures\Billed Invoke “Billed quantity” measure
previous Member Quantity), definition.
[0CALMONTH].PrevMember)</EXPRESSION>
Filtered measure <EXPRESSION>((@Select(Key Figures\Billed Invoke “Billed quantity” measure
Quantity), [0CALQUARTER].[19981], definition.
[0D_DIV].[7])</EXPRESSION>
Filtered measure <EXPRESSION>((@Select(Key Figures\Billed Invoke “Billed quantity” measure
with dynamic Quantity), definition.
member @Prompt(‘Division?’,’N’,’Division\L01
Division’,mono,constrained))</EXPRESSION> Prompt user to select a member
from the Division/Level 01 dimension
Standard <EXPRESSION>Stddev({[0CALQUARTER].[19983] Invoke “Billed quantity” measure
deviation , [0CALQUARTER].[19982], definition.
[0CALQUARTER].[19981]}, @Select(Key
Figures\Billed Quantity))</EXPRESSION>
Measure increase <EXPRESSION>@Select(Measures\Reseller Invoke “Reseller Sales Amount”
Sales Amount) + measure definition.
(@Select(Measures\Reseller Sales Amount)
* @Prompt('Enter increase Prompt user to enter a percentage
percentage','N',,mono,free) /100 value to increase Reseller Sales
)<EXPRESSION> Amount.
Date comparison <EXPRESSION>IIF(CDate([Time].[Default].Cu Compare Time.date with dates
rrentMember.MemberValue) >= prompted.
CDate('@Prompt('Enter
date','D',,mono,free)')-@Prompt('Number Prompt user to enter a date and a
of days before prompted number of days to define the
date?','N',,mono,free) AND boundaries.
CDate([Time].[Default].CurrentMember.Memb
erValue) <= CDate('@Prompt('Enter This calculated measure works only
date','D',,mono,free)'), 1, with Microsoft because “CDate” is
0)<EXPRESSION> not supported by SAP BW.
4 Universe pre-defined filters

4.1 Filter operators

Here is the list of supported operators in OLAP universes:


Operator Universe operator syntax
Equal Equal
Not equal NotEqual
Greater Greater
Greater than or equal GreaterOrEqual
Less Less
Less than or equal LessOrEqual
Between Between
Not between NotBetween
In list InList
Not in list NotInList
Matches pattern Like
Different from pattern NotLike

4.2 Samples

FILTER TYPE SAP Netweaver MSAS 2005 and 2008


Mandatory filter <FILTER <FILTER
with prompt KEY="[0D_DIV].[LEVEL01]"><CONDITI KEY="[Date].[Calendar].[Calendar
ON Year]"><CONDITION
OPERATORCONDITION="Equal"><CONSTA OPERATORCONDITION="InList"><CONST
NT CAPTION="@Prompt('L01 ANT CAPTION="@Prompt('Calendar
Division','A','Division\L01 Year(s)','A','Date.Calendar\Calen
Division',mono,constrained)"/></C dar
ONDITION></FILTER> Year',multi,constrained)"/></COND
ITION></FILTER>
Mandatory filter <FILTER KEY="@Select(Division\L01 <FILTER
with prompt Division)"><CONDITION KEY="@Select(Date.Calendar\Calend
referencing a OPERATORCONDITION="Equal"><CONSTA ar )"><CONDITION
NT CAPTION="@Prompt('L01 OPERATORCONDITION="InList"><CONST
universe Division','A','Division\L01 ANT CAPTION="@Prompt('Calendar
dimension Division',mono,constrained)"/></C Year(s)','A','Date.Calendar\Calen
ONDITION></FILTER> dar
Year',multi,constrained)"/></COND
ITION></FILTER>
Optional filter with <OPTIONAL><FILTER <OPTIONAL><FILTER
prompt KEY="[0D_DIV].[LEVEL01]"><CONDITI KEY="[Date].[Calendar].[Calendar
ON Year]"><CONDITION
OPERATORCONDITION="Equal"><CONSTA OPERATORCONDITION="InList"><CONST
NT CAPTION="@Prompt('L01 ANT CAPTION="@Prompt('Calendar
Division','A','Division\L01 Year(s)','A','Date.Calendar\Calen
Division',mono,constrained)"/></C dar
ONDITION></FILTER></OPTIONAL> Year',multi,constrained)"/></COND
ITION></FILTER></OPTIONAL>
Optional filter with <OPTIONAL><FILTER <FILTER
prompt referencing KEY="@Select(Division\L01 KEY="@Select(Date.Calendar\Calend
a universe Division)"><CONDITION ar )"><CONDITION
OPERATORCONDITION="Equal"><CONSTA OPERATORCONDITION="InList"><CONST
dimension NT CAPTION="@Prompt('L01 ANT CAPTION="@Prompt('Calendar
Division','A','Division\L01 Year(s)','A','Date.Calendar\Calen
Division',mono,constrained)"/></C dar
ONDITION></FILTER> Year',multi,constrained)"/></COND
ITION></FILTER></OPTIONAL>
Filter with default <FILTER <FILTER
value (with Index KEY="[0D_DIS_CHAN].[LEVEL01].[TEC KEY="[Date].[Calendar].[Calendar
Awareness) H_NAME]"><CONDITION Quarter].[TECH_NAME]"><CONDITION
OPERATORCONDITION="InList"><CONST OPERATORCONDITION="InList"><CONST
ANT CAPTION="@Prompt('L01 ANT CAPTION="@Prompt('Calendar
Distribution Quarter','A','Date.Calendar\Calen
Channel','A','Distribution dar
Channel\L01 Distribution Quarter',multi,primary_key,,{‘Q2
Channel',multi,primary_key,,{‘Dir CY
ect 2002’:’&[2002]&[2]’)"/></CONDITIO
Sales’:’[0D_DIS_CHAN].[1]’)"/></C N></FILTER>
ONDITION></FILTER>
Filter with default <FILTER <FILTER
value (without KEY="[0D_DIS_CHAN].[LEVEL01] KEY="[Date].[Calendar].[Calendar
Index Awareness) "><CONDITION Quarter] "><CONDITION
OPERATORCONDITION="InList"><CONST OPERATORCONDITION="InList"><CONST
ANT CAPTION="@Prompt('L01 ANT CAPTION="@Prompt('Calendar
Distribution Quarter','A','Date.Calendar\Calen
Channel','A','Distribution dar
Channel\L01 Distribution Quarter',multi,primary_key,,{‘Q2
Channel',multi,primary_key,,{‘Dir CY 2002’)"/></CONDITION></FILTER>
ect
Sales’)"/></CONDITION></FILTER>
Filter with <FILTER <FILTER
constants (with KEY="[0D_DIS_CHAN].[LEVEL01].[TEC KEY="[Date].[Calendar].[Calendar
Index Awareness) H_NAME]"><CONDITION Quarter].[TECH_NAME]"><CONDITION
OPERATORCONDITION="InList"><CONST OPERATORCONDITION="InList"
ANT ><CONSTANT
CAPTION="[0D_DIS_CHAN].[1]"/><CON CAPTION="[Date].[Calendar].[Calen
STANT dar
CAPTION="[0D_DIS_CHAN].[12]"/></C Quarter].&[2002]&[2]"/><CONSTANT
ONDITION></FILTER> CAPTION="[Date].[Calendar].[Calen
dar
Quarter].&[2001]&[4]"/></CONDITIO
N></FILTER>
Filter with <FILTER <FILTER
constants (without KEY="[0D_DIS_CHAN].[LEVEL01]"><CO KEY="[Date].[Calendar].[Calendar
Index Awareness) NDITION Quarter]"><CONDITION
OPERATORCONDITION="InList"><CONST OPERATORCONDITION="InList"
ANT CAPTION="Direct Sales" ><CONSTANT CAPTION="Q2 CY
/><CONSTANT CAPTION="Final 2002"/><CONSTANT CAPTION="Q4 CY
Customer 2001"/></CONDITION></FILTER>
Sales"/></CONDITION></FILTER>
Dynamic operator <FILTER <FILTER KEY="[Product].[Product
KEY="[0D_DIS_CHAN].[LEVEL01]"><CO Categories].[Category]"><CONDITIO
NDITION N
OPERATORCONDITION="@prompt('Distr OPERATORCONDITION="@prompt('Produ
ibution Channel ct Category
operator','N',{'Greater','Less',' operator','N',{'Greater','Less','
Equal','Like'},mono,free,,{'Like' Equal','Like'},mono,free,,{'Like'
})"><CONSTANT })"><CONSTANT
CAPTION="@Prompt('L01 CAPTION="@Prompt('Product
Distribution Category','A',’Product
Channel','A','Distribution Categories\Category’,mono,free)"/
Channel\L01 Distribution ></CONDITION></FILTER>
Channel',mono,free)"/></CONDITION
></FILTER>
Combined filter <OPERATOR <OPERATOR
with OR operator VALUE="OR"><OPTIONAL><FILTER VALUE="OR"><OPTIONAL><FILTER
(useful with KEY="[0CALYEAR].[LEVEL01]"><CONDI KEY="[Date].[Calendar].[Calendar
TION Year]"><CONDITION
optional prompts OPERATORCONDITION="InList"><CONST OPERATORCONDITION="InList"><CONST
and free fill) ANT CAPTION="@prompt('Enter ANT CAPTION="@prompt('Enter
value(s) for L01 Calendar value(s) for Calendar
year:','A','Calendar year\L01 Year:','A','Date.Calendar\Calenda
Calendar year',Multi,Free)" r Year',Multi,Free)"
/></CONDITION></FILTER></OPTIONAL /></CONDITION></FILTER></OPTIONAL
><OPTIONAL><FILTER ><OPTIONAL><FILTER
KEY="[0CALQUARTER].[LEVEL01]"><CO KEY="[Date].[Calendar].[Calendar
NDITION Quarter]"><CONDITION
OPERATORCONDITION="InList"><CONST OPERATORCONDITION="InList"><CONST
ANT CAPTION="@prompt('Enter ANT CAPTION="@prompt('Enter
value(s) for L01 Cal. value(s) for Calendar
Year/Quarter:','A','Cal. Quarter:','A','Date.Calendar\Cale
Year/Quarter\L01 Cal. ndar Quarter',Multi,Free)"
Year/Quarter',Multi,Free)" /></CONDITION></FILTER></OPTIONAL
/></CONDITION></FILTER></OPTIONAL ><OPTIONAL><FILTER
><OPTIONAL><FILTER KEY="[Date].[Calendar].[Month]"><
KEY="[0CALMONTH].[LEVEL01]"><COND CONDITION
ITION OPERATORCONDITION="InList"><CONST
OPERATORCONDITION="InList"><CONST ANT CAPTION="@prompt('Enter
ANT CAPTION="@prompt('Enter value(s) for
value(s) for L01 Cal. Month:','A','Date.Calendar\Month'
Year/Month:','A','Cal. ,Multi,Free)"
Year/Month\L01 Cal. /></CONDITION></FILTER></OPTIONAL
Year/Month',Multi,Free)" ></OPERATOR>
/></CONDITION></FILTER></OPTIONAL
></OPERATOR>
Combined filter <OPERATOR <OPERATOR
with AND operator VALUE="AND"><OPTIONAL><FILTER VALUE="AND"><OPTIONAL><FILTER
KEY="[0CALYEAR].[LEVEL01]"><CONDI KEY="[Date].[Calendar].[Calendar
TION Year]"><CONDITION
OPERATORCONDITION="InList"><CONST OPERATORCONDITION="InList"><CONST
ANT CAPTION="@prompt('Enter ANT CAPTION="@prompt('Enter
value(s) for L01 Calendar value(s) for Calendar
year:','A','Calendar year\L01 Year:','A','Date.Calendar\Calenda
Calendar year',Multi,Free)" r Year',Multi,Free)"
/></CONDITION></FILTER></OPTIONAL /></CONDITION></FILTER></OPTIONAL
><OPTIONAL><FILTER ><OPTIONAL><FILTER
KEY="[0CALQUARTER].[LEVEL01]"><CO KEY="[Date].[Calendar].[Calendar
NDITION Quarter]"><CONDITION
OPERATORCONDITION="InList"><CONST OPERATORCONDITION="InList"><CONST
ANT CAPTION="@prompt('Enter ANT CAPTION="@prompt('Enter
value(s) for L01 Cal. value(s) for Calendar
Year/Quarter:','A','Cal. Quarter:','A','Date.Calendar\Cale
Year/Quarter\L01 Cal. ndar Quarter',Multi,Free)"
Year/Quarter',Multi,Free)" /></CONDITION></FILTER></OPTIONAL
/></CONDITION></FILTER></OPTIONAL ></OPERATOR>
></OPERATOR>
Filter with a <FILTER <FILTER
calculated member EXPRESSION="IIF([0CALYEAR].Curren EXPRESSION="IIF([Date].[Calendar]
in the filter tMember > “2000”, 1, .CurrentMember.Name > ‘CY 2002’,
0)"><CONDITION 1, 0)"><CONDITION
expression OPERATORCONDITION="Equal"><CONSTA OPERATORCONDITION="Equal"><CONSTA
NT NT
CAPTION="1"/></CONDITION></FILTER CAPTION="1"/></CONDITION></FILTER
> >
Filter with a <FILTER <FILTER
calculated member EXPRESSION="@Select(Calendar EXPRESSION="@Select(Date.Calendar
referenced in the Year\My Calculated \My Calculated
Member)"><CONDITION Member)"><CONDITION
filter expression OPERATORCONDITION="Equal"><CONSTA OPERATORCONDITION="Equal"><CONSTA
NT NT
CAPTION="1"/></CONDITION></FILTER CAPTION="1"/></CONDITION></FILTER
> >

4.3 Other samples

Requirement:
I want to select a member in a hierarchy but I don’t know to which level it belongs.

Solution:
Create a filter that contains all the hierarchy levels and select the following options
Optional prompt
No list of values
Prompt operator: Matches pattern
Global operator: OR

Sample with the hierarchy Accounts on AdventureWorks:

OLAP universe filter syntax:


<OPERATOR VALUE="OR" >
<OPTIONAL>
<FILTER KEY="[Account].[Accounts].[Account Level 06]" >
<CONDITION OPERATORCONDITION="Like" >
<CONSTANT CAPTION="@prompt('Enter value(s) for
Account:','A',,Mono,Free,Persistent,,User:0,optional)" />
</CONDITION>
</FILTER>
</OPTIONAL>
<OPTIONAL>
<FILTER KEY="[Account].[Accounts].[Account Level 05]" >
<CONDITION OPERATORCONDITION="Like" >
<CONSTANT CAPTION="@prompt('Enter value(s) for
Account:','A',,Mono,Free,Persistent,,User:0,optional)" />
</CONDITION>
</FILTER>
</OPTIONAL>
<OPTIONAL>
<FILTER KEY="[Account].[Accounts].[Account Level 04]" >
<CONDITION OPERATORCONDITION="Like" >
<CONSTANT CAPTION="@prompt('Enter value(s) for
Account:','A',,Mono,Free,Persistent,,User:0,optional)" />
</CONDITION>
</FILTER>
</OPTIONAL>
<OPTIONAL>
<FILTER KEY="[Account].[Accounts].[Account Level 03]" >
<CONDITION OPERATORCONDITION="Like" >
<CONSTANT CAPTION="@prompt('Enter value(s) for
Account:','A',,Mono,Free,Persistent,,User:0,optional)" />
</CONDITION>
</FILTER>
</OPTIONAL>
<OPTIONAL>
<FILTER KEY="[Account].[Accounts].[Account Level 02]" >
<CONDITION OPERATORCONDITION="Like" >
<CONSTANT CAPTION="@prompt('Enter value(s) for
Account:','A',,Mono,Free,Persistent,,User:0,optional)" />
</CONDITION>
</FILTER>
</OPTIONAL>
<OPTIONAL>
<FILTER KEY="[Account].[Accounts].[Account Level 01]" >
<CONDITION OPERATORCONDITION="Like" >
<CONSTANT CAPTION="@prompt('Enter value(s) for
Account:','A',,Mono,Free,Persistent,,User:0,optional)" />
</CONDITION>
</FILTER>
</OPTIONAL>
</OPERATOR>
5 When using universe @functions

5.1 Using @Select function

You can define any new object by entering its definition (MDX or Essbase) or by referencing an
existing object by using @Select function.

We recommend using @Select as much as possible rather than the object definition for multiple
reasons:
Life Cycle Management only ensure integrity with generated objects not with objects
created by a user: @Select always guarantee the validity of the object
@Select allow to define a level or part of it and to be reuse anywhere in the universe

@Select can be used anytime in:


Objects definition
Details definition
Measures definition
Pre-defined filters definition
Where clause of Objects / Details / Measures
Calculated measures

5.2 Using @Prompt function

@Prompt is a way to define parameters in the universe that will let users to choose among a list
of values/members one or multiple values.
Those parameters can be selected at query time by users to restrict the data to be retrieved: the
answers to these parameters can be mandatory or optional.
@Prompt can also be defined with default values.
Last these parameters can also be automatically added to the query with no user intervention:
they act like SAP variables (compulsory filters).

We recommend using widely @Prompt in universes because they provide a lot of flexibility
when building reports, queries, analysis or dashboards.
Moreover it is strongly recommended to use as much as possible @Prompt with QaaWS in
order to be consumed with XCelsius Enterprise

@Prompt is used in order to:


Choose dynamically a measure
Choose dynamically a hierarchy level
Choose dynamically a dimension and a hierarchy level
Enter a value for:
o Computations
o Select a relative position from a current member: Lead or Lag functions
o Use to retrieve partially members based on a top/bottom selection: Rank function

5.3 Samples

The table underneath shows samples of prompt usage in order to have queries more dynamic.

Sample Universe definition


Choose a level from the Date [Date].[Calendar Year].[@prompt('Calendar
Calendar dimension in an level','N',{'(All)','Calendar Year','Calendar
MSAS cube Semester','Calendar
Quarter','Month','Date'},mono,constrained)]
Choose a dimension among the [0CAL@Prompt('Calendar
different “time” dimensions Level?','N',{'YEAR','QUARTER','MONTH','DAY'},mono,constr
available in a SAP Netweaver ained)].[LEVEL01]
cube
Choose a measure among the [Measures].[@prompt('Measure','N',{'Reseller Sales
different measures available in Amount','Reseller Order Count','Sales Amount
an MSAS cube Quota'},mono,constrained)]
Choose a measure among the [Measures].[0D_@prompt('Measure','N',{'COST','INV_QTY','
different measures available in NETVLINV',’TAXAMOUN’},mono,constrained)]
an SAP Netweaver cube
Select a range of members in <EXPRESSION>Aggregate( {
the Date Calendar dimensionn [Date].[Calendar].CurrentMember:[Date].[Calendar].Curren
starting from the current tMember.lead(@Prompt('Number of
periods','N',,mono,free)) }, @Select(Measures\Reseller
member in an aggregated Sales Amount) )</EXPRESSION>
measure

You might also like