SAP Business Objects – Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

Embed Size (px)

Citation preview

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    1/25

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 1

    SAP Business Objects Profilingand Bucketing OLAP Memberswith Microsoft Analysis Servicesand Oracle Hyperion Essbase

    Applies to:

    SAP BusinessObjects XI 4.0 Feature Pack 3, the information design tool, Microsoft Analysis Services 2008and Oracle Hyperion Essbase 11. For more information, visit theBusiness Objects homepage.

    Summary

    Count measures are useful for giving a summary view of the data and revealing the distribution of membersacross a hierarchy or calculated buckets. In this article we describe how to define Business Objectsmeasures for profiling members from an OLAP cube across different types of hierarchies: geography,

    organization, stores or gender. We explain how to build simple counts like number of cities or number ofproducts as well as ratios like percentage of females or percentage of managers. The last chapter covers thecreation of buckets for a top count analysis and for custom groupings like profit range and age group.

    This paper focuses on the MDX constructs involved which are calculated measure, named set andcalculated member. Those constructs are generated at query time as elements in the With clause of theMDX query. They dont require any changes in the target OLAP cube. You can find all the examplespresented in this article in the business layers attached.

    Please download attached fileshere.

    Author: Marc Daniau

    Company: SAP

    Created on:19 December 2011

    Author Bio

    Marc Daniau joined Business Objects in 1992 as project consultant in France. He moved to theproduct group in San Jose in 1998 to work on EPM products. He moved back to Paris in 2003 towork within the semantic layer team.

    http://www.sdn.sap.com/irj/bochttp://www.sdn.sap.com/irj/bochttp://www.sdn.sap.com/irj/bochttp://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/305ffa1d-e124-2f10-c1a4-c946b8f62497http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/305ffa1d-e124-2f10-c1a4-c946b8f62497http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/305ffa1d-e124-2f10-c1a4-c946b8f62497http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/305ffa1d-e124-2f10-c1a4-c946b8f62497http://www.sdn.sap.com/irj/boc
  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    2/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 2

    Table of Content

    Profiling across Hierarchies ................................................................................................................................ 3

    Level-based hierarchy ..................................................................................................................................... 3

    Unbalanced hierarchy ..................................................................................................................................... 6

    Attribute hierarchy ........................................................................................................................................... 7

    Conditional count .............................................................................................................................................. 10

    Condition on attribute .................................................................................................................................... 10

    Condition on a measure ................................................................................................................................ 12

    Condition on member depth .......................................................................................................................... 14

    Computing buckets ........................................................................................................................................... 15

    Top count buckets ......................................................................................................................................... 15

    Profit ranges .................................................................................................................................................. 18

    Age groups .................................................................................................................................................... 20

    Related Content ................................................................................................................................................ 24

    Copyright........................................................................................................................................................... 25

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    3/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 3

    Profiling across Hierarchies

    We will start with queries counting members across a hierarchy whether it is a level-based, parent-child orattribute hierarchy. We assume that a business layer has already been generated automatically by readingthe OLAP catalog. Our work will consist of adding calculated measures to the existing business layer.

    Level-based hierarchy

    Let us take the hierarchy Customer Geography from the Microsoft cube Adventure Works. Here is the

    MDX definition of the measure Nb of Citiesadded to the business layer.

    Count( Descendants([Customer].[Customer Geography].CurrentMember,[Customer].[Customer Geography].[City]) )

    From the information design tool, within a query, the count measure is evaluated dynamically against thechosen levels.

    In Essbase, the count measure is expressed using the same MDX functions: count and descendants.

    Count( Descendants([Market].CurrentMember, [Market].[State]) )

    We use the cube Sample.Basic that comes with Hyperion. A level-based hierarchy All>Region>Statehasbeen added to the business layer under the Market dimension. The query is illustrated below.

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    4/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 4

    Before we move to the next section regarding unbalanced hierarchies, we will compare a calculated countdefined in the Business Layer with a count measure predefined in the cube. We will go back to our BusinessLayer on Adventure Works and add the measure Nb of Customerswith the following MDX expression.

    Count( Descendants([Customer].[Customer Geography].CurrentMember,[Customer].[Customer Geography].[Customer]) )

    Using that measure we can find the Canadian cities with over 95 customers.

    The cube Adventure Workshappens to already include a measure Internet Customers\Customer Count. Ifwe replace our calculated count with that measure in the query above we obtain the exact same result.However as soon as we start adding another dimension to the query, the two measures behave differently.With the predefined measure from the cube, we can see the US customers count over time as shown below.

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    5/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 5

    Note: the count for all periods is a distinct count; a customer appearing in multiple years is counted only once. If we usethe calculated count instead of the predefined count from the cube, the total count value repeats itself for eachyear.

    Our calculated count is not multidimensional. Assuming that the measure Internet Customers \CustomerCount did not exist in the cube, and that we needed a multidimensional count of customers, we could usethe following expression in the calculated measure Count of Customers.

    Count(

    Filter(

    {Descendants([Customer].[Customer Geography].CurrentMember,

    [Customer].[Customer Geography].[Customer])},

    [Measures].[Internet Order Quantity] > 0)

    )

    With that measure we can compute the customers count by product category and year as illustrated below.

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    6/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 6

    Unbalanced hierarchy

    With an unbalanced hierarchy, the members to be counted cannot be specified through a given level as thedepth of the hierarchy varies from one branch to another. Therefore we will use the keyword leaves ratherthan a level name in the MDX expression.

    Count( Descendants([Organization].[Organizations].CurrentMember,,LEAVES) )

    Essbase provides the same technique to count members within an unbalanced hierarchy. Let us take theproduct hierarchy from the cube ASOsamp.Samplethat comes with Hyperion. We can count leaf memberswith the following MDX expression.

    Count( Descendants([Products].CurrentMember, 20, LEAVES) )

    Note that we must specify how deep we need to go.

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    7/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 7

    Attribute hierarchy

    Unlike the level-based and parent-child hierarchies we have been using so far, attribute hierarchies dontcontain the detailed members of the dimension. If you preview the content of an attribute hierarchy likeMarital Status for instance, you will not be able to drill to the customers.

    What if you need to profile your customers by Marital Status? This is what we will cover in this section.

    In order to count the detailed members of a dimension across an attribute hierarchy, we must involve twohierarchies:

    1. The attribute hierarchy required as the distribution criterion2. A hierarchy that includes the dimension detailed members

    An example is the measure Nb of Products by Stylefor which we have to join the attribute hierarchy Stylewith the hierarchy Product.

    Count( Crossjoin({[Product].[Style].CurrentMember},{[Product].[Product].[Product].Members}) )

    Knowing that the product dimension contains many attributes, we would rather build a dynamic measure thatworks with any attribute hierarchy. For that, we will use the MDX metadata functions provided by MicrosoftAnalysis Services. Here is a more generic measure Nb of Productswhere we have substituted thehierarchy Style with an MDX expression (highlighted below) that reads the context of the query to determinethe hierarchy being used:

    Count( Crossjoin({Axis(1).Item(0).Item(Axis(1).Item(0).Count-1).Dimension.CurrentMember},{[Product].[Product].[Product].Members}) )

    If we want to express the count in percentage, we need to calculate the measure Nb of All Products.

    Count( [Product].[Product].[Product].Members )

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    8/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 8

    The ratio % Productsreferences the two previously defined measures.

    @select(Product\Profiling\Nb of Products) /@select(Product\Profiling\Nb of All Products) * 100

    The function @select() is a Business Objects function to reference an existingobject of the business layer; it will be replaced at query time to form a standard MDX expression.

    In the query below we have chosen the hierarchy Product Line. Automatically the count measure adjusts

    itself to that choice thanks to the metadata functions.

    Our 606 products are distributed across product lines as follows.

    We find attribute hierarchies in Oracle Hyperion Essbase cubes too. However the MDX syntax for countingdetailed members across an attribute hierarchy is different with Essbase. If we express a simple cross-joinas we did with Adventure Works, we end up with a Cartesian product. In order to get a meaningful count wewill use the Essbase MDX function Attribute(). Here is the definition of the measure Attribute Profiling\Nb ofProducts by Packagingagainst the Essbase cube Sample.Basic.

    Count( Crossjoin({[Pkg Type].CurrentMember}, Attribute([Pkg Type].CurrentMember)) )

    The distribution of actual products by packaging type looks like this.

    If we want to make the count measure more generic so that it applies to any attribute hierarchy, we can usethe Business Objects prompting capability to let the end-user choose the product attribute at run time. Hereare the steps to achieve a count measure on a prompted attribute.

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    9/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 9

    First we define a static list of values with the names of all the attribute hierarchies that we want to makeavailable to the end-user.

    We then create a prompt based upon the list of values.

    Now we can add to the business layer the dimension object Attribute Profiling\Product Attributewhich MDXset expression references the prompt we have just defined.

    { [@prompt(Product Attribute)].Children }

    The function @prompt() is a Business Objects function to invoke a prompt authored in thebusiness layer; it will be replaced at query time with the answer given by the end-user.

    The last step consists of defining a generic measure called Attribute Profiling\Nb of Productswhichexpression references twice the previously created prompt.

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    10/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 10

    Count( Crossjoin({[@Prompt(Product Attribute)].CurrentMember},

    Attribute([@Prompt(Product Attribute)].CurrentMember)) )

    One can invoke the same prompt multiple times in an MDX expression; at query time only one singlequestion will be asked to the end-user.

    To obtain the numbers in percentage, we add the measure Attribute Profiling\Nb of All the Products

    Count( Attribute([@prompt(Product Attribute)]) )

    and the measure Attribute Profiling\% Products.

    @select(Product\Attribute Profiling\Nb of Products) /

    @select(Product\Nb of All Products) * 100

    Let us put those new objects together in a query. When refreshing the query in the information design tool,we must select among four attributes.

    The attribute Caffeinated is a Boolean value; we observe that the products are split roughly half-half.

    Conditional count

    In the previous chapter we have seen how to build count measures according to the different types ofhierarchies. In the coming chapter, we will explore scenarios that request counting OLAP members onlywhen they meet a certain condition. The condition can apply to a member attribute, to a measure or to thedepth of the member.

    Condition on attribute

    Analyzing individuals by gender is a common case for profiling customers, employees or students. To

    illustrate how to compute a Percent Females measure we will use the Microsoft cube Adventure Works.

    Let us assume we want to retrieve the departments for which the percentage of female employees is greaterthan a given threshold. There are different ways to express the filter on gender. We can build a named setFemale employeesout of the hierarchy Employee

    Filter( {[Employee].[Employee].[Employee].Members},

    [Employee].[Employees].Properties("Gender") = "Female" )

    And then join that set with the hierarchy Department.

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    11/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 11

    Count( Crossjoin([Female employees],Descendants([Employee].[Employee Department].CurrentMember,

    [Employee].[Employee Department].[Employee])) )

    The cube Adventure Works happens to have an attribute hierarchy on Gender.

    Instead of defining a named set we can directly join the hierarchy Gender with the hierarchy Department;and build that join into the measure Nb of Females.

    Count( Crossjoin({[Employee].[Gender].[Female]},

    Descendants([Employee].[Employee Department].CurrentMember,[Employee].[Employee Department].[Employee])) )

    We can copy paste the measure Nb of Femalesand turn it into a second measure Nb of Malesbyreplacing the member [Female] with [Male]. The measure Nb of Males & Femalesis obtained by simplyadding the two measures defined earlier.

    @select(Employee\Gender by Dept\Nb of Males) +@select(Employee\Gender by Dept\Nb of Females)

    The measure % Femalesis defined as the ratio:

    @select(Employee\Gender by Dept\Nb of Females) /@select(Employee\Gender by Dept\Nb of Males & Females)

    We are now able to find the departments where the female employees represent more than 40% of the totalpopulation.

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    12/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 12

    Essbase has a specific concept called User Defined Attribute (UDA) that allows tagging members thusoffering a flexible way for the Business Intelligence tool to filter members . In the cube Sample.Basic thedimension Market contains three UDAs: Major Market, Small Market and New Market. We will see next howto compute the proportion of new markets.

    In the measure Nb of New Marketsbelow, we employ the function UDA() to find members tagged as newmarket and we retain only new markets that belong to the list of states under the Market current member.

    Count( Intersect( {UDA([Market], "New Market")},Descendants([Market].CurrentMember, [Market].[State])) )

    For calculating the measure % New Marketswe reuse the measure Nb of Statesdefined in our first

    Essbase example. Its MDX expression was:Count( Descendants([Market].CurrentMember, [Market].[State]) )

    Last, we create the ratio % New Markets.

    @select(Market\Nb of new Markets) / @select(Market\Nb of States) * 100

    We can now find out how much new markets we have for each region and overall.

    Condition on a measure

    OLAP cubes store membersattributes but more importantly they store measures. Let us see how we canexpress a condition on a measure as part of a count calculation. With the Adventure Works cube, we wantto profile resellers by type but only when their profit reaches a given threshold. We need to compare theprofitable resellers with all the resellers. Here is the expression for computing the measure Nb of Resellers

    across the hierarchy Reseller Type.Count( Descendants([Reseller].[Reseller Type].CurrentMember,

    [Reseller].[Reseller Type].[Reseller]) )

    To make the count restricted to profitable resellers, we will apply an MDX filter and join the filtered list ofresellers with the current member of the hierarchy Reseller Type.Here is the MDX expression for the newcalculated measure Nb of Resellers with profit > 7000.

    Count( Crossjoin( {[Reseller].[Reseller Type].CurrentMember},Filter( {[Reseller].[Reseller].[Reseller].Members},

    [Measures].[Reseller Gross Profit] > 7000 )) )

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    13/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 13

    The query definition and its results are presented below.

    We can build the same type of query against the Essbase cube Sample.Basicto analyze profitableproducts. Rather than hard coding the level of profitability as we did in our previous example, we will prompt

    it to make the query more dynamic. For that we need to author a prompt in the business layer.

    We reference this prompt from the measure Nb of Profitable Products. Since we dont want to includeshared members in the count we invoke the function Attribute() that retrieves actual members only.

    Count( Intersect(Filter(Attribute([Pkg Type]), [Profit] > @prompt(Threshold)),Descendants([Product].CurrentMember, [Product].[SKU])) )

    We add the measure Product\Nb of Productsthat contains no condition.

    Count( Intersect(Attribute([Pkg Type]),Descendants([Product].CurrentMember,[Product].[SKU])) )

    When running the query, the user must enter a threshold value.

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    14/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 14

    The number of products for the Diet Drinks node returns zero since this node only contains shared members.

    Condition on member depth

    We will close this chapter on conditional counts with a use case where the condition is based upon themember position in a hierarchical tree. Our goal here is to compute the percentage of managers by genderusing the Microsoft OLAP cube AdventureWorks. The first question to solve is how to determine that anemployee is a manager. There is no member attribute in the cube telling us whether an employee is amanager or not. We cannot rely on the lowest level of the hierarchy Employees as the tree is unbalanced.Therefore we will consider manager anyone who is not a leaf member in the parent-child hierarchyEmployees. In order to complete our analysis we need to join the set of Managers with the attribute

    hierarchy Gender. The issue is that such join results into a Cartesian product. To allow a meaningful join,we must translate the tree of managers into a flat list of managers. This will be done using the MDX functionLinkMember() in the definition of the named set Managers given below.

    Generate( Except(Except({[Employee].[Employees].Members}, [Employee].[Employees].[All Employees]),Descendants([Employee].[Employees].[All Employees], , LEAVES) )

    ,{LinkMember([Employee].[Employees].CurrentMember, [Employee].[Employee])} )

    Now we are able to perform a meaningful join between the named set Managersand the hierarchyGender to calculate the measure Managers by Gender\Nb of Managers.

    Count( Crossjoin({[Employee].[Gender].CurrentMember},@select(Employee\Managers by Gender\Managers)) )

    The measure Managers by Gender\Nb of All Managersis defined as follows.

    Count( Crossjoin({[Employee].[Gender].[All Employees]},@select(Employee\Managers by Gender\Managers)) )

    Remains the calculation of the measure Managers by Gender\% Managerswhich references the twopreviously defined measures.

    @select(Employee\Managers by Gender\Nb of Managers) /@select(Employee\Managers by Gender\Nb of All Managers) * 100

    Let us run our query: percentage of managers by gender. We observe that the percentage of femalemanagers is nearly 30%.

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    15/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 15

    Computing buckets

    In the two previous chapters, we have run our profiling measures against hierarchies that are pre-definedstructures built into the OLAP cube. The business user in addition to using the hierarchies may request otherways for looking at his count measures. Our last chapter is dedicated to the definition of buckets whichconstitute custom groupings of members. Buckets can be added to the business layer by using the namedset and the calculated member functionalities provided in the information design tool.

    Top count buckets

    When dealing with a hierarchy that includes a large number of nodes, it is common practice to filter the top nparents and aggregate the rest of the parent members into a bucket Others. In the Essbase cubeASOsamp.Sample for instance the Stores dimension includes 239 stores from 17 different chains. To findthe largest chains in terms of number of stores, we are going to use the MDX function TopCount().

    A first named set that we call Top 4 Chainsis defined as:

    TopCount( [Stores].[Chain].Members, 4,Count( Descendants([Stores].CurrentMember, [Stores].[Store]) ) )

    A second named set Other Chainsis derived from the first.

    Except( [Stores].[Chain].Members, @select(Stores\Top 4 Chains) )

    The calculated member Othersis built upon the set Other Chainsto summarize the counts.

    Sum( @select(Stores\Other Chains) )

    The calculated measure Nb of Stores uses the technique we saw in the first chapter for counting by level.

    Count( Descendants([Stores].CurrentMember, [Stores].[Store]) )

    The Top Count query looks like this.

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    16/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 16

    We can also conduct a top count analysis against a Microsoft cube. Let us assume that the requirementconsists of finding the n most populated departments; n being a parameter for the end user to answer atquery time. Here are the steps involved to address that requirement.

    First we author a prompt in the business layer for the parameter.

    We then build a named set Biggest n Depts which expression references the authored prompt.

    TopCount( [Employee].[Employee Department].[All Employees].Children, @prompt(Top N),Count( Descendants([Employee].[Employee Department].CurrentMember,

    [Employee].[Employee Department].[Employee]) ) )

    In order to get the departments that are not part of the top n, we define the named set Other Deptsthattakes all the departments minus the departments found in the named set Biggest n Depts.

    Except( [Employee].[Employee Department].[All Employees].Children,@select(Employee\Large Depts\Biggest n Depts) )

    We add a calculated member Other Deptsthat we attach to the member All Employees of the hierarchyEmployee Department. It summarizes the counts of employees from the departments considered as others.

    In the last step we create the measure Nb of Empl. by Deptwhich expression follows.

    Count( Descendants([Employee].[Employee Department].CurrentMember,[Employee].[Employee Department].[Employee]) )

    Note : we must specify solve orders for the calculated member (52) and the calculated measure (40), so that theMicrosoft MDX engine performs the sum of counts as expected.

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    17/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 17

    We are now ready to retrieve the most populated departments.

    After answering 3 to the prompt Top N limit, we obtain the following table.

    Various report layouts can be achieved with buckets depending on the business needs. For instance we canadd a member Biggest Deptsto the business layer.

    Sum( @select(Employee\Large Depts\Biggest n Depts) )

    By adding ratio measures in the business layer, we can evaluate how much a bucket weighs.

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    18/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 18

    Profit ranges

    In the previous chapter we saw that we could count products only when they reached a certain level ofprofitability. To push the example further, we are going to define buckets representing profit ranges.

    Within the business layer ESB_Profiling, we add three calculated members under the Product hierarchy.

    Here is the definition of the profit ranges for actual product members (we discard the shared members).

    Name Expression of calculated memberSolve

    order

    Profit = 0 and [Profit] = 7000) ) 53

    The query below tells us how the number of products and the sales amount are distributed across theprofitability buckets.

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    19/25

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    20/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 20

    Age groups

    Age is a typical attribute used to profile a population. However the age attribute may not exist in the OLAPcube. When the cube includes a birth date attribute like in Adventure Works, we are able to compute theage on the fly using Microsoft date functions. Here is the list of measures added to the business layer forcalculating the age derived from the birth date of each employee. The present example involves manycalculations that we need to order so that the OLAP engine can solve conflicts between calculated measuresand calculated members.

    Name Expression of calculated measureSolve

    order

    Today now() 10

    Today

    number

    (year(@select(Generic\Today)) * 10000) +(month(@select(Generic\Today)) * 100) +day(@select(Generic\Today))

    15

    Birth Date [Employee].[Employee].CurrentMember.Properties("Birth Date") 20

    Birth Datenumber

    (year(@select(Employee\Age groups\Birth Date)) * 10000) +(month(@select(Employee\Age groups\Birth Date)) * 100) +day(@select(Employee\Age groups\Birth Date))

    25

    Agevba!int((@select(Generic\Today Number) -@select(Employee\Age groups\Birth Date Number)) / 10000)

    30

    For the computation of age groups, we create a series of calculated members under the Employeeattributehierarchy.

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    21/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 21

    To compute an age group we filter the employees based upon the calculated measure Age.

    Name Expression of calculated memberSolve

    order

    Age 0-29Sum( Filter([Employee].[Employee].[Employee].Members,

    @select(Employee\Age groups\Age) < 30) )51

    Age 30-39Sum( Filter([Employee].[Employee].[Employee].Members,

    @select(Employee\Age groups\Age) >= 30 AND@select(Employee\Age groups\Age) < 40))

    52

    Age 70+Sum( Filter([Employee].[Employee].[Employee].Members,

    @select(Employee\Age groups\Age) >= 70) )56

    We package the calculated members into a business named set Age groupsso that one can easily dragand drop the named set from the business layer to the query panel.

    We define the measure Age groups\Nb of Employeeswith a solve order of 40 and the expression:

    Count( Descendants([Employee].[Employee].CurrentMember,

    [Employee].[Employee].[Employee]) )

    We are now ready to profile employees by age groups. Since the calculation is based on the current date, weexpect the results to change as the date of the query execution changes.

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    22/25

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    23/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 23

    In the query below we show all the age groups including the empty groups for each department chosen inthe member selector: Production, Purchasing and Sales. To return the empty buckets, we must tick the boxRetrieve empty rows in the query panel properties.

  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    24/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX -bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com

    2011 SAP AG 24

    Related Content

    Sample Universe on Microsoft OLAP cube

    information design tool - eLearning

    For more information, visit theBusiness Objects homepage.

    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b0b69a4d-2652-2e10-7d8a-ed1a62699f30http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b0b69a4d-2652-2e10-7d8a-ed1a62699f30http://www.sdn.sap.com/irj/scn/info-design-tool-elearninghttp://www.sdn.sap.com/irj/scn/info-design-tool-elearninghttp://www.sdn.sap.com/irj/bochttp://www.sdn.sap.com/irj/bochttp://www.sdn.sap.com/irj/bochttp://www.sdn.sap.com/irj/bochttp://www.sdn.sap.com/irj/scn/info-design-tool-elearninghttp://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b0b69a4d-2652-2e10-7d8a-ed1a62699f30
  • 8/12/2019 SAP Business Objects Profiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    25/25

    SAP Business ObjectsProfiling and Bucketing OLAP Members with Microsoft Analysis Services and Oracle Hyperion Essbase

    Copyright

    Copyright 2011 SAP AG. All rights reserved.

    No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG.The information contained herein may be changed without prior notice.

    Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.

    Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.

    IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9,iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server,PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes,BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX,Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation.

    Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.

    Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe SystemsIncorporated in the United States and/or other countries.

    Oracle is a registered trademark of Oracle Corporation.

    UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.

    Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks ofCitrix Systems, Inc.

    HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts

    Institute of Technology.

    Java is a registered trademark of Oracle Corporation.

    JavaScript is a registered trademark of Oracle Corporation, used under license for technology invented and implemented by Netscape.

    SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, and other SAP products and services mentionedherein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries.

    Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, andother Business Objects products and services mentioned herein as well as their respective logos are trademarks or registeredtrademarks of Business Objects S.A. in the United States and in other countries. Business Objects is an SAP company.

    All other product and service names mentioned are the trademarks of their respective companies. Data contained in this documentserves informational purposes only. National product specifications may vary.

    These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAPGroup") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors oromissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the

    express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting anadditional warranty.