Вы находитесь на странице: 1из 19

ORACLE SALES CLOUD – IMPLEMENTATION NOTE

CREATING CROSS-SUBJECT AREA REPORTS


USING BI ANSWERS

Revised July 12, 2016


CONTENTS

Introduction............................................................................................................................................ 4

What is a Cross-Subject Area Report?.................................................................................................... 4

Combining Queries from Multiple Subject Areas ................................................................................... 4

Using Set Operations to Combine Multiple Result Sets ....................................................................... 11

Combining Logical SQL using Advanced Tab ........................................................................................ 14

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 2 of 19
SAFE HARBOR

The following is intended to outline our general product direction. It is intended for information
purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any
material, code, or functionality, and should not be relied upon in making purchasing decisions. The
development, release, and timing of any features or functionality described for Oracle’s products
remains at the sole discretion of Oracle.

ABOUT THIS DOCUMENT

This document supplements standard product documentation, which you are encouraged to review. To
find documentation and other learning resources, such as guides, whitepapers, and videos, visit the
Help Center for Oracle Sales Cloud.

AUDIENCE

This document is for Oracle Sales Cloud customers involved in implementation. The tips and techniques
detailed in this document may not be suitable for an on-premise deployment of Oracle Sales Cloud
Applications. This document assumes that you know how to write reports using BI Answers.

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 3 of 19
INTRODUCTION

Oracle Transactional BI (OTBI) is a real-time reporting solution for Oracle Sales Cloud. This document
contains recommendations for building OTBI reports using BI Answers advance techniques. It focuses on
how to create cross-subject area reports and addresses some of the main issues report developers face
when generating such reports.

WHAT IS A CROSS-SUBJECT AREA REPORT?

Oracle Transactional BI organizes reporting data elements, such as dimensions and facts, by business
function in “subject areas.” Each subject area contains a collection of dimensional attributes and
measures relating to one dimensional STAR model and grouped into individual folders. The term STAR
refers to the semantic model where a single fact is joined to multiple dimensions.

You can create a report that combines data from more than one subject area. Such a report is referred
to as a cross-subject area query in this document. We will discuss three different types of cross-subject
area queries and how the result sets vary depending on which type is used. Cross-subject area queries
can be classified into three broad categories:

 Combining queries from multiple subject areas


 Using common (conformed) dimensions
 Using local and common (conformed) dimensions
 Using a ‘Set Operation’ (Union or Union All, for example) to combine more than one result set
from same or different subject areas
 Combining logical SQL using the Advance tab

A common dimension is a dimension that exists in all subject areas that are being joined in a report. For
example, the Customer dimension is a common dimension for the “Sales - CRM Pipeline" and
"Marketing - CRM Leads" subject areas.

A local dimension is a dimension that exists only in one subject area. For example, Opportunity and
Revenue are local dimensions for the “Sales - CRM Pipeline” subject area.

COMBINING QUERIES FROM MULTIPLE SUBJECT AREAS

The simplest and fastest way to generate a report is to use a single subject area. If the dimension
attributes and fact metrics that you are interested in are all available from a single subject area, then
you should use that subject area to build the report. Such a report will result in better performance and
will be much easier to maintain.

If your report requirements cannot be met by any single subject area because you need metrics from
more than one subject area, you can build a cross-subject area query using common dimensions. There
are clear advantages to building a cross-subject area query using only common dimensions and we
highly recommend using this approach, if possible.

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 4 of 19
Keep in mind that if you use three subject areas for a report, for example, your common dimensions
must exist in all three subject areas. Joining on common dimensions gives you the benefit of being able
to include any metric from any of the subject areas in a single report.

Importance of Using Common Dimensions

While BI Answers allows you to create a report joining any subject area you have access to, only a cross-
subject area query that uses common dimensions will return data that is at the same dimension grain.
This is necessary so the data is cleanly merged and results in a report that returns exactly the data you
want to see.

Knowing how cross-subject area queries are executed in Oracle BI will help you understand the
importance of using common dimensions when building such a report. When a cross-subject area report
is generated, separate queries are executed for each subject area in the report and the results are
merged to generate the final report. The data that is returned from the different subject areas is
merged using the common dimensions. When you use common dimensions, the result set returned by
each subject area query is at the same dimensional grain, so it can be cleanly merged and rendered in
the report.

The following examples illustrate this behavior in detail. In the examples, we use cross-subject area
queries to report on metrics that come from separate subject areas (facts), using common and local
dimensions.

EXAMPLE: USING COMMON DIMENSIONS

In this example, we want to pull the number of Opportunities, number of Opportunity Revenue Lines,
number of Leads, and number of Activities by Customer. The common dimension in all three subject
areas used for this report is Customer and different fact metrics are pulled from each subject area.

The subject areas that we will use for this report are:
 Subject area 1: "Marketing - CRM Leads"
 Subject area 2: "Sales - CRM Pipeline"
 Subject area 3: "Sales - CRM Sales Activity"

The common dimension that we will use from each subject area is Customer:
 "Marketing - CRM Leads"."Customer" -- Customer
 "Sales - CRM Pipeline"."Customer" -- Customer
 "Sales - CRM Sales Activity"."Customer" -- Customer

The metrics (measures) are:


"Marketing - CRM Leads"."Lead Facts" . "# of Leads"
"Sales - CRM Pipeline"."Pipeline Detail Facts". "# of Opportunity Revenue Lines"
"Sales - CRM Pipeline"."Pipeline Facts" . "# of Opportunities"
"Sales - CRM Sales Activity"."Activity Facts"."# of Activities"

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 5 of 19
Logical SQL:
SELECT
0 s_0,
"Marketing - CRM Leads"."Customer"."Corporate Account Name" s_1,
"Marketing - CRM Leads"."Lead Facts"."# of Leads" s_2,
"Sales - CRM Pipeline"."Pipeline Detail Facts"."# of Opportunity Revenue Lines" s_3,
"Sales - CRM Pipeline"."Pipeline Facts"."# of Opportunities" s_4,
"Sales - CRM Sales Activity"."Activity Facts"."# of Activities" s_5
FROM "Marketing - CRM Leads"
ORDER BY 1, 2 ASC NULLS LAST
FETCH FIRST 75001 ROWS ONLY

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 6 of 19
EXAMPLE: USING LOCAL AND COMMON DIMENSIONS

In this example, we want to pull by Customer; number of Opportunity Revenue Lines by Product and
number of Activities by Activity Type. Customer is a common dimension in both subject areas that we
will use for this query. Product is a local dimension to the Sales - CRM Pipeline subject area and Activity
is a local dimension to Sales - CRM Sales Activity. Different fact metrics are pulled from each subject
area.

Note: Use of local dimension may impact the grain of the report. In such cases the metrics may get
repeated for each of these rows.

Subject Areas:

Subject area 1: "Sales - CRM Pipeline"


Subject area 2: "Sales - CRM Sales Activity"

Common Dimension:

"Sales - CRM Pipeline"."Customer"


"Sales - CRM Sales Activity"." Customer "

Local Dimensions:

"Sales - CRM Pipeline"."Product"


"Sales - CRM Sales Activity"."Activity"

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 7 of 19
Metrics (measures):
"Sales - CRM Sales Activity"."Activity Facts"."# of Activities"
"Sales - CRM Pipeline"."Pipeline Detail Facts"."# of Opportunity Revenue Lines"

Logical SQL:
SET VARIABLE ENABLE_DIMENSIONALITY=1;SELECT
0 s_0,
"Sales - CRM Pipeline"."Customer"."Corporate Customer Unique Name" s_1,
"Sales - CRM Pipeline"."Product"."Product Name" s_2,
"Sales - CRM Sales Activity"."Activity"."Activity Type Code" s_3,
"Sales - CRM Pipeline"."Pipeline Detail Facts"."# of Opportunity Revenue Lines" s_4,
"Sales - CRM Sales Activity"."Activity Facts"."# of Activities" s_5
FROM "Sales - CRM Pipeline"
ORDER BY 1, 2 ASC NULLS LAST, 3 ASC NULLS LAST, 4 ASC NULLS LAST
FETCH FIRST 75001 ROWS ONLY

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 8 of 19
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 9 of 19
Guidelines and best practices for creating a cross-subject area analysis using multiple subject areas
and common dimensions:

 If all the metrics and attributes needed for the report are available in a single subject area and
fact, use that subject area only and do not create a cross subject area query. Such a report will
perform better and will be easier to maintain.
 When joining two subject areas in a report, make sure at least one attribute from a common
dimension is used in the report.
 When using common dimensions always pick attributes from the common dimension from a
single subject area. For instance if you are using the Customer dimension to build a query
between subject area 1 and subject area 2, then select all customer dimension attributes from
either subject area 1 or from subject area 2. (Not some customer attributes from subject area 1
and some from subject area 2.) In some scenarios, the common dimension may have more
attributes in one subject area than the other. In such a situation, you can only use the subset of
common attributes for a cross-subject area query.
 Always include a measure from each subject area that is being used in your report. You do not
have to display measures or use them, but you should include them. You can hide a measure if it
is not needed in the report.
 When using common and local dimensions please use SET VARIABLE
ENABLE_DIMENSIONALITY=1; in the Advanced SQL tab.

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 10 of 19
USING SET OPERATIONS TO COMBINE MULTIPLE RESULT SETS

You can use set operations to combine more than one result set from the same or different subject
areas. In this example, we will create a compound analysis query that is a union of two result subsets
from same subject area, combining results from:

 "# of Opportunity Revenue Lines" by "Territory" from the "Territory Management - CRM
Pipeline" subject area (result 1)
 "# of Sales Accounts" by "Territory" from the "Territory Management - CRM Sales Accounts"
subject area (result 2)
SELECT
saw_0,
saw_1
FROM (
(
SELECT
IFNULL("Territory"."Territory", 'Unspecified')||'~~ # of Opty Revn Lines' saw_0,
"Pipeline Detail Facts"."# of Opportunity Revenue Lines" saw_1
FROM "Territory Management - CRM Pipeline"
)
UNION
(
SELECT
IFNULL("Territory"."Territory", 'Unspecified')||'~~ # of Sales Accounts' saw_0,
"Sales Account Facts"."# of Sales Accounts" saw_1
FROM "Territory Management - CRM Sales Accounts"
)

) t1 ORDER BY saw_0

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 11 of 19
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 12 of 19
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 13 of 19
COMBINING LOGICAL SQL USING ADVANCED TAB

If your requirement cannot be met by either of the two methods already discussed, then there is
another advanced technique which you might be able to use. This technique allows you to join multiple
logical SQL statements based on common id/keys, which can be written against the same or different
subject areas, just as used in normal SQL. It supports both Equi and Outer Join. The following example
demonstrates this technique.

USING THE ADVANCED TAB TO COMBINE LOGICAL SQL


The following example illustrates how the metrics on Territory assignment & Resource assignment data
for Opportunities can be combined together to get a single report using advanced logical SQLs.

Step 1: Write a BI Answers query using the "Sales - CRM Opportunity Territory" subject area to show
the "# of Opportunity Territory Assignments" and Opportunity. Once the correct results are achieved,
go to the Advanced tab and grab the logical SQL associated to this query.

Logical SQL for the above query : Query 1


SELECT
"Opportunity"."Opportunity ID" saw_0,
"Opportunity Territory Facts"."# of Opportunity Territory Assignments" saw_1
FROM "Sales - CRM Opportunity Territory"

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 14 of 19
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 15 of 19
Step 2: Write a second BI Answers query using the "Sales - CRM Opportunity Resource" subject area to
show "# of Opportunity Resource Roles" associated to the Opportunity, as shown below. Once the
correct results are achieved, go to the Advanced tab and grab the logical SQL associated to this query.
Logical SQL for the above query : Query 2
SELECT
"Opportunity"."Opportunity ID" saw_0,
"Opportunity Resource Facts"."# of Opportunity Resource Roles" saw_1
FROM "Sales - CRM Opportunity Resource"

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 16 of 19
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 17 of 19
Step 3: Go to the Advanced tab in BI Answers and copy/paste the following logical SQL which is an OBIEE
- Equi Join of the two previous SQL statements based on Opportunity ID:

Note: Use any text editor to combine the logical SQL statements copied from Steps 1 and 2.

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 18 of 19
SELECT
Opty_Terr.saw_0 OptyID,
Opty_Terr.saw_1 OptyTerrAsgnCnt,
Opty_Resource.saw_1 OptyRsrcRoleCnt
FROM
(
SELECT
"Opportunity"."Opportunity ID" saw_0,
"Opportunity Territory Facts"."# of Opportunity Territory Assignments" saw_1
FROM "Sales - CRM Opportunity Territory" ) Opty_Terr ,
(
SELECT
"Opportunity"."Opportunity ID" saw_0,
"Opportunity Resource Facts"."# of Opportunity Resource Roles" saw_1
FROM "Sales - CRM Opportunity Resource" ) Opty_Resource
Where Opty_Terr.saw_0 = Opty_Resource.saw_0
ORDER BY OptyID

Important: If you create a new analysis using this SQL, any hierarchical columns, member selection,
groups or formatting will be stripped out.

You can be creative based on your requirements, but be careful with the formatting (use Notepad or an
equivalent tool). Make sure that you have extra space at the end of each line before you plug the SQL in
the new analysis window.

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Oracle Proprietary and Confidential - Distributed to Authorized Customers Page 19 of 19

Вам также может понравиться