Before You Begin
This tutorial shows you how to create parameters to use as filters in a workbook in Oracle Analytics.
Background
In Oracle Analytics, you use a parameter like a user-defined variable that stores and manages a reusable value. A parameter has a beginning value to initialize the parameter as the current value. When used as a filter, your business analyst consumers can change the current value by interacting with the parameter's possible values. Parameters reset to their initial (beginning) value when a consumer reopens the workbook.
In this tutorial, you create two parameters, one for selecting dimensions and another one for selecting measures. Users can only choose from the list of values in the parameters. This tutorial example uses a bar visualization with a dashboard filter control. However, you can use parameters in dashboard filter controls with other visualization types.
What Do You Need?
- Access to Oracle Analytics
- Download sample_order_lines2023.xlsx to your computer
Create a Dataset
In this section, you add the sample_order_lines2023.xlsx
file to Oracle Analytics to create a dataset table.
- Sign in to Oracle Analytics.
- On the Home page, click Create, and then click Dataset.
- In Create Dataset, click Drop data file here or click to browse, select the sample_order_lines2023.xlsx file, and then click Open.
- In Create Dataset Table from sample_order_lines2023.xlsx, click OK. Click Save
.
- In Save Dataset As, enter
sample_order_lines2023
, and then click OK.Description of the illustration sample_order_lines2023.png
Create a Workbook and Dimensions Parameter
In this section, you create a workbook using the sample_order_lines dataset and define the Dimensions parameter. Your parameters appear in the workbook's Parameters panel.
- Click Create Workbook.
- In the workbook, click Parameters
.
- Click Add
. In Create Parameter, enter
Dimensions
in Name. Use Text as the Data Type. - In Available Values, select Value. In the Value field, enter
Order Priority
. - Click Add Value
. In Value, enter
City
. - Click Add Value
. In Value, enter
Customer Segment
. - Click Add Value
. In Value, enter
Product Name
. - In Initial Value with Value as the option, enter
Order Priority
. Click OK. - Click Save
. In Save Workbook, enter
Column Selector
in Name and click Save.
Create a Measures Parameter
In this section, you create a parameter for the measures in the sample_order_lines dataset.
- In the workbook, click Parameters
.
- Click Add
. In Create Parameter, enter
Measures
in Name. In the Data Type row, click Integer, and then click Text. - In Avaliable Values, select Value. In the Value field, enter
Sales
. - Click Add Value
. In Value, enter
Profit
. - Click Add Value
. In Value, enter
Discount
. - Click Add Value
. In Value, enter
Gross Unit Price
. - Click Add Value
. In Value, enter
Shipping Cost
. - In Initial Value with Value as the option, enter
Sales
. Click OK. - Click Save
Create a Visualization
In this section, you create a bar visualization.
- Click Data
. In the Data panel, under sample_order_lines, hold down the Ctrl key, select Sales and Order Priority, and then drag them to the canvas.
- In the Sales by Order Priority bar visualization, click Menu
, select Sort By, select Sales, and then select High to Low.
Description of the illustration sales_bar_viz.png - Click Save
Add a Dashboard Control for the Parameters
In this section, you use a dashboard control to enable consumers to select the dimensions and measures to use in their workbooks.
- Click Visualizations
.
- Scroll to Dashboard Controls, select Dashboard Filters
and drag it to the canvas, and then release it above the Sales by Order Priority visualization.
- Click Parameters
.
- In the Parameters panel, select the Dimensions parameter and drag it to Filter Controls in the Grammar
panel.
- In the Parameters panel, select the Measures parameter, and drag it to Filter Controls in the Grammar
panel.
Description of the illustration parameters_in_dashboard.png - Click Save
Connect the Dimensions Parameters to the Visualization
In this section, you create an expression in the My Calculations folder to connect the Dimensions parameter to the column selector visualization. The dimensions in the parameter are Order Priority, City, Customer Segment, and Product Name.
While completing the expression:
- The when value represents a value in the Dimensions parameter; surround this value in single quotes.
- The then value is the matching data element that you selected from the dataset by entering a portion of the data element name, for example ord for Order Priority.
- The else value is the last value in the Dimensions parameter. You must include
end
after the last parameter value.
- Select the Dashboard Filter visualization.
- Click Data
. In the Data panel, right-click My Calculations, and then click Add Calculation.
- In New Calculation, enter
Dimension X-axis
in Name. - In the expression field, enter
case
. Click Parameter, select and drag the Dimensions parameter to the expression field.
Description of the illustration drag_dim_param_calc.png - In the
@parameter("Dimensions")(default value)
field, enter'Order Priority'
. After the default value, enterwhen 'Order Priority' then
enterord
and select Order Priority. - Complete the expression's when, then, else statement with the remaining values in the Dimensions parameter.
Your expression should look like the following.
Description of the illustration dimensions_calc.png - Click Validate and then click Save.
- Click the bar visualization. Drag Dimension X-axis to Category (X-axis) to replace Order Priority in the Grammar panel.
- Select City from the Dimensions list.
The bar visualization shows the change to city on the X-axis.
Description of the illustration dim_wired_2_viz.png
Connect the Measure Parameters to the Visualization
In this section, you create a calculation expression for the measures defined in the Measures parameter. The measures in the parameter are Sales, Profit, Discount, Gross Unit Price, and Shipping Cost.
- Select the Dashboard Filter visualization.
- Click Data
. In the Data panel, right-click My Calculations, and then click Add Calculation.
- In New Calculation, enter
Measure Y-axis
in Name. - In the expression field, enter
case
. Click Parameter, select and drag the Measures parameter to the expression field.
- In the
@parameter("Measures")(default value)
field, enter'Sales'
. After the default value, enterwhen 'Sales' then
entersal
and select Sales. - Complete the expression's when, then, else statement with the remaining values in the Measures parameter.
Your expression should look like the following.
Description of the illustration measure_calc.png - Click Validate and then click Save.
- Click the bar visualization. Drag Measure Y-axis to Category (Y-axis) to replace Sales in the Grammar panel.
- In the dashboard filter, select Profit from the Measures list.
The bar visualization shows the change to profit on the Y-axis.
Description of the illustration city_profit_vis.png - Click Save
.
Review the Column Selector Workbook
- Click Go back
.
- On the Home page, hover over the Column Selector workbook, click Actions
, and then select Open.
Description of the illustration default_column_selections.png - Select a Dimension to view the change in the visualization.
- Select a Measure to view the change in the visualization.
Learn More
Create a Dimension and Measure Selector in Oracle Analytics
F77248-02
May 2024
Learn how to create dimension and measure parameters, and expose the parameters as an interactive filter control in Oracle Analytics.
This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.
If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable:
U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs) and Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government end users are "commercial computer software" or "commercial computer software documentation" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, reproduction, duplication, release, display, disclosure, modification, preparation of derivative works, and/or adaptation of i) Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs), ii) Oracle computer documentation and/or iii) other Oracle data, is subject to the rights and limitations specified in the license contained in the applicable contract. The terms governing the U.S. Government's use of Oracle cloud services are defined by the applicable contract for such services. No other rights are granted to the U.S. Government.
This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
Intel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Epyc, and the AMD logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group.
This software or hardware and documentation may provide access to or information about content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services, except as set forth in an applicable agreement between you and Oracle.