Oracle® Fusion Middleware User's Guide for Oracle Business Intelligence Discoverer Plus 11g Release 1 (11.1.1) Part Number B4010502 


View PDF 
This chapter explains how to use Discoverer Plus Relational's calculations to answer typical business questions. For example, what are my top three best selling products? This chapter contains the following topics:
"What analytic function templates are available in Discoverer?"
"How to create a calculation using an analytic function template"
Calculations are worksheet items based on formulas or expressions (for example, mathematical formulas, or text handling functions). You use calculations to provide additional analysis to worksheets. In the figure below, the worksheet contains the calculation 'Profit (SalesCosts)', which calculates the value of sales (that is, the Sales SUM item) minus the value of costs (that is, the Cost SUM item).
For example:
to calculate a 25% increase in sales, you might create a calculation item with the following formula:
Sales SUM * 1.25
to convert the City item into uppercase letters, you might create a calculation item with the following formula:
UPPER(City)
to calculate the ranked list position (that is, using a Rank function) of values in descending order, you might create a calculation item with the following formula:
RANK() OVER(ORDER BY Sales SUM DESC)
Advanced functions such as Rank are known as analytic functions. For more information about analytic functions, see "What are analytic functions?".
Note: Discoverer provides easytouse templates for the most popular analytic functions (for more information, see "What analytic function templates are available in Discoverer?").
When you have defined calculations, you can use them in worksheets just like other worksheet items. For example, you can:
pivot calculations to the page axis
include calculations in condition statements to filter worksheet data
display or hide calculations on worksheets
reuse calculations within other calculations
Notes
Oracle BI Discoverer supports all functions that are supported by the version of the Oracle database being used. In other words, you have access to hundreds of predefined functions that you can use to support all of your business intelligence requirements.
You might want to create a calculation to concatenate two (or more) items. To concatenate items, insert CHR(10) between items. For example, to create a worksheet column containing the Calendar Year item and the Department item, create a calculation as follows:
Calendar YearCHR(10)Department
Worksheets containing this item display Calendar Year and Department in a single column. For example:
2002 Sales Department
Various countries in the world use different characters as decimal separators. For example, the period (.) is used as a decimal separator in the United Kingdom and in the United States. The comma (,) is used as a decimal separator in Germany and France.
For calculations, Discoverer uses the English format, for example, 167727.2. To use a different character as a decimal separator, then you must enclose the number in single quotation marks. For example, to use a comma separator, enter the number as: '167727,2'.
If you use a character other than a period as the separator and if you omit the single quotation marks, then Discoverer treats the number as two separate input values, for example, 167727 and 2. This can cause incorrect data to be returned.
Calculations can be created by the Discoverer manager or Discoverer users. When a worksheet contains calculations, you can:
display the calculations (or turn the calculations on)
hide the calculations (or turn the calculations off)
Calculations are displayed as new columns on worksheets. Calculations can be used in other calculations. Discoverer enables you to use a comprehensive range of predefined functions for use in worksheet calculations. Discoverer also provides easytouse templates for the most popular analytic functions (for more information, see "What analytic function templates are available in Discoverer?" and "Examples of using rowbased and timebased intervals").
Analytic functions are advanced mathematical and statistical calculations that you can use to analyze data and make business decisions. For example, these functions can answer questions such as:
what are my best selling products?
how do current sales compare with last year's sales?
what is the average sales transaction amount in the region with the largest number of sales transactions per year?
Note: Analytic functions are a subset of the SQL functions available in the Oracle database.
In the example below, the Rank Sales item contains an analytic function that calculates the ranked list position of Cities according to sales performance. Using the Rank Sales column, you can see that New York is ranked number 1 with total sales of $85,974.23.
You can create analytic functions in the following ways:
using an easytouse template to help you build the function (for more information, see "How to create a calculation using an analytic function template")
Note: Discoverer provides easytouse templates for the most popular analytic functions (for more information, see "What analytic function templates are available in Discoverer?").
creating a worksheet calculation and entering an analytic function as the formula text (for more information, see "How to create calculations")
Discoverer Plus Relational provides easytouse templates for the most popular analytic functions. These templates enable you to perform complex business intelligence analysis quickly and easily.
Note: For examples of analytic functions created using templates, see "Examples of using rowbased and timebased intervals".
Discoverer provides templates for the following types of analysis:
Band by rank  creates several bands (for example, quartiles) and places each value into one of the bands according to its ranked list position (for more information, see "Band by Rank dialog")
Band by value  creates several bands (sometimes referred to as buckets) and places each value into one of the bands according to the value (for more information, see "Band by Value dialog")
Difference  typically calculates the change in values across time (for more information, see "Difference dialog")
Following value  returns the value that is a specified number of rows or a specified time period after each value (for more information, see "Following Value dialog")
Group total  aggregates values within a group (for more information, see "Group Total dialog")
Moving total  calculates a total for the specified number of rows or a specified time period before each value (for more information, see "Moving Total dialog")
Percent contribution  calculates the ratio of a value to the sum of a set of values (for more information, see "Percent Contribution dialog")
Percent difference  typically calculates the change in values across time as a percentage (for more information, see "Percent Difference dialog")
Percent rank  calculates the relative position of a value in a group of values (for more information, see "Percent Rank dialog")
Percent running contribution  can be used in 8020 analysis (for more information, see "Percent Running Contribution dialog")
Preceding value  returns the value that is a specified number of rows or a specified time period before each value (for more information, see "Preceding Value dialog")
Rank  calculates the ranked list position of values (for more information, see "Rank dialog")
Running total  calculates the total from the value at the start of the group to each value (for more information, see "Running Total dialog")
Notes
When you use an analytic function template, you populate the Calculation field with the SQL statement for the analytic function formula. You can manually edit the SQL statement at any time in the Calculation field.
For more information about analytic functions, see "What are analytic functions?".
For more information about using analytic function templates, see "How to create a calculation using an analytic function template".
When a worksheet contains calculations, you can display or hide the calculations. You display calculations on a worksheet when you want to use them to analyze worksheet data. You hide calculations on a worksheet when you do not need to use them to analyze worksheet data. For example, you might display a calculation when you export a worksheet.
To display or hide calculations:
Display the worksheet you want to analyze.
Choose Tools  Calculations to display the "Edit Worksheet dialog: Select Items tab: Calculations tab".
The Calculations tab lists existing calculations, percentages, and totals available in the worksheet. Active calculations are marked with a checkmark in the Available list and are also displayed in the Selected list.
To display an existing calculation, move the calculation from the Available list to the Selected list.
To hide an existing calculation, move the calculation from the Selected list to the Available list.
Click OK to close the Calculations tab and display the worksheet.
Discoverer refreshes the worksheet.
Notes
You can also display existing calculations in the following way:
If the Available Items pane is displayed, drag and drop a calculation from the Calculations tab to the worksheet.
You can also hide calculations in the following way:
If the Selected Items pane is displayed, rightclick on a calculation in the Selected Items list and select Remove from Worksheet.
To remove a calculation item from the worksheet permanently, delete the calculation (see "How to delete calculations").
You create calculations to analyze a worksheet in a new way. For example:
to calculate a 25% increase in sales
to calculate the rank of sales figures
Note: Discoverer provides easytouse templates for the most popular analytic functions (for more information, see "What analytic function templates are available in Discoverer?").
To create a calculation:
Display the worksheet you want to analyze.
Choose Tools  Calculations to display the "Edit Worksheet dialog: Select Items tab: Calculations tab".
The Calculations tab lists existing calculations, percentages, and totals available in the worksheet. Active calculations are marked with a checkmark in the Available list and are also displayed in the Selected list.
Click New and select New Calculation from the drop down list to display the "New Calculation dialog".
Enter a name for the calculation in the What do you want to name this calculation? field.
Hint: Use a short descriptive name, which is displayed on the worksheet.
Enter the calculation formula in the Calculation field.
If you are familiar with calculation syntax, you can type the formula in the Calculation field.
Note: If you type a formula in the Calculation field, you must prefix the formula with an equals sign (that is, =).
If you prefer, you can build the calculation in stages using any of the following methods:
To add an item from the business area to the calculation, choose Selected Items or Available Items from the Show drop down list, select an item from the item list below, then click Paste to copy the item into the Calculation field.
To add a function to the calculation, choose Functions from the Show drop down list, select a function from the list below, then click Paste to copy the function into the Calculation field.
To add existing calculations to the calculation, choose Calculations from the Show drop down list, select a calculation from the list below, then click Paste to copy the calculation into the Calculation field.
To include a mathematical operator in the calculation, click the appropriate operator button below the Calculation field.
Hint: Before pasting items in the Calculation field, position the cursor in the Calculation field where you want to insert the item.
To use an analytic function template to create the formula, click Insert Formula from Template to display a popup list of templates and choose a template (for more information about using analytic function templates, see "How to create a calculation using an analytic function template").
Note: Calculations follow the standard Oracle calculation syntax. For a full description of this syntax, see the Oracle Database SQL Language Reference.
Click OK to save the details and close the New Calculation dialog.
Click OK to close the Calculations tab and return to the worksheet.
Discoverer adds the calculation to the worksheet.
Notes
You can also create a calculation in the following ways:
Select the worksheet item to use in the calculation, then select the New Calculation option on the Standard toolbar and choose one of the calculation types available.
Select two worksheet items to use in the calculation, then select the New Calculation option on the Standard toolbar and choose one of the calculation types available. For example, if you select item 1 and item 2 and choose + from the New Calculation options, Discoverer creates a calculation with the function item 1 + item 2.
If the Available Items pane is displayed, select the New Calculation option on the Available Items toolbar (for more information, see "Available Items pane").
If the Available Items pane is displayed, display the Calculations tab, rightclick on My Calculations, and select New Calculation.
For examples of the most commonly used functions, see "Discoverer calculation examples".
When using the Show drop down list to display items:
use the Selected option to restrict the list to items in the worksheet
use the Available option to display all items in the business area
For a full list of Show options, see "New Calculation dialog".
If you have copied calculation text into memory from another application (for example, an email message), click inside the Calculation field, rightclick the mouse and choose Edit  Paste to copy the text into the Calculation field.
If a calculation contains a syntax error, Discoverer displays an error message. You must correct syntax errors before you can save the calculation.
For more information about adding parameters to calculations, see "About using parameters to collect dynamic user input".
Discoverer provides easytouse templates for the most popular analytic functions (for more information, see "What analytic function templates are available in Discoverer?"). You use templates to build analytic functions that help you analyze data in powerful ways and make business decisions quickly and easily. For example, you might want to calculate the ranked list position (that is, rank) of sales outlets based on sales.
You use a template to create an analytic function formula, which is inserted into the definition of a new or existing Discoverer calculation.
To create a calculation using an analytic function template:
Display the worksheet you want to analyze.
Choose Tools  Calculations to display the "Edit Worksheet dialog: Select Items tab: Calculations tab".
The Calculations tab lists existing calculations, percentages, and totals available in the worksheet. Active calculations are marked with a checkmark in the Available list and are also displayed in the Selected list.
Click New and select New Calculation from the drop down list to display the "New Calculation dialog".
Enter a name for the calculation in the What do you want to name this calculation? field.
Hint: Use a short descriptive name, which is displayed on the worksheet.
Click Insert Formula from Template to display a popup list of predefined templates.
Choose a template from the popup list to display a template dialog for the selected analytic function.
Use the template to define the analytic function.
For example, if you choose the Rank template, you use the "Rank dialog" to create the formula.
The underlying SQL statement for the analytic function formula is displayed in the Calculation field at the bottom of the template.
Click OK to save the analytic function and close the analytic function template.
The SQL statement for the analytic function that you created is transferred to the Calculation field. You might want to modify the SQL statement for the analytic function (for example, by adding more ORDER BY clauses) or by inserting another function into the Calculation field.
The Calculation field displays the underlying SQL statement for the analytic function that you defined.
Note: You can subsequently modify the calculation (for example, to add more PARTITION BY clauses) in any of the following ways:
by manually editing the formula in the Calculation field
by first deleting the formula in the Calculation field, then clicking Insert Formula from Template and recreating the formula
by clicking Insert Formula from Template and appending a new formula to the existing formula in the Calculation field
Note: If you have multiple functions in the Calculation field, you must associate the functions (for example, using + or ).
Click OK to save the details and close the New Calculation dialog.
Click OK to close the Calculations tab and return to the worksheet.
Discoverer adds the calculation to the worksheet.
Notes
You can also create a calculation in the following ways:
If the Available Items pane is displayed, select the New Calculation option on the Available Items toolbar (for more information, see "Available Items pane").
If the Available Items pane is displayed, display the Calculations tab, rightclick on My Calculations, and select New Calculation.
For more information about analytic functions, see "What are analytic functions?" and "Examples of using rowbased and timebased intervals".
To use parameter values in analytic functions to collect dynamic input, you must manually prefix the item name with a ':' (that is, colon) character in the Calculation field (for more information, see "About using parameters to collect dynamic user input").
For example, you might create a Band by rank formula based on the Profit SUM item (for example, NTILE(4) OVER (ORDER BY Profit SUM DESC). If you want end users to select the number of bands at run time, you might create a worksheet parameter called Band number. To use the Band number in the Band by rank formula you must manually change the formula to:
NTILE(:Band number) OVER (ORDER BY Profit SUM DESC)
Analytic functions follow the standard Oracle function syntax. For a full description of this syntax, see the Oracle Database SQL Language Reference.
You edit calculations to change the way that they behave. For example, to change a percentage increase calculation from 25% to 30%.
To edit a calculation:
Display the worksheet you want to analyze.
Choose Tools  Calculations to display the "Edit Worksheet dialog: Select Items tab: Calculations tab".
The Calculations tab lists existing calculations, percentages, and totals available in the worksheet. Active calculations are marked with a checkmark in the Available list and are also displayed in the Selected list.
Select a calculation in the Available list.
Click Edit to display "Edit Calculation dialog".
Modify the calculation (for example, to add more PARTITION BY clauses) in any of the following ways:
by manually editing the formula in the Calculation field
by first deleting the formula in the Calculation field, then clicking Insert Formula from Template and recreating the formula
by clicking Insert Formula from Template and appending a new formula to the existing formula in the Calculation field
Note: If you have multiple functions in the Calculation field, you must associate the functions (for example, using + or ).
Click OK to save the details and close the Edit Calculation dialog.
Click OK to close the Calculations tab and return to the worksheet.
Discoverer updates the calculation.
Notes
You can also edit calculations in the following way:
If the Available Items pane is displayed, display the Calculations tab, rightclick on a calculation, and select Edit.
You cannot edit calculations created by the Discoverer manager. Only the Discoverer manager can edit calculations that they have created. To use a similar calculation, do the following:
Create a calculation.
Cut and paste the calculation text from the Discoverer manager's calculation into the new calculation.
Modify the calculation formula as required.
If a calculation contains a syntax error, Discoverer displays an error message. You must correct syntax errors before you can save the calculation.
You delete a calculation when you no longer need it and want to remove it permanently from a worksheet. For example, you might have created a temporary calculation to answer a question from a colleague. After printing the report, you want to remove the calculation from the worksheet.
To delete a calculation:
Display the worksheet you want to analyze.
Choose Tools  Calculations to display the "Edit Worksheet dialog: Select Items tab: Calculations tab".
The Calculations tab lists existing calculations, percentages, and totals available in the worksheet. Active calculations are marked with a checkmark in the Available list and are also displayed in the Selected list.
Select a calculation in the Available list.
Click Delete.
Click OK to return to the worksheet.
Discoverer removes the calculation that you specified.
Notes
You can also delete calculations in the following way:
If the Available Items pane is displayed, display the Calculations tab, rightclick on a calculation, and select Delete.
To remove a calculation from a worksheet without deleting it permanently, you can hide the calculation (see "How to display or hide worksheet calculations").
You cannot delete calculations created by the Discoverer manager. Only the Discoverer manager can delete calculations that they have created.
If you delete a calculation that is used in other calculations, all of the dependent calculations are also deleted.