Академический Документы
Профессиональный Документы
Культура Документы
Introduction............................................................................................................................................ 4
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.
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.
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.
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:
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.
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.
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.
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
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:
Common Dimension:
Local Dimensions:
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
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.
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
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.
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.
Note: Use any text editor to combine the logical SQL statements copied from Steps 1 and 2.
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.