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?

Create a Dataset

In this section, you add the sample_order_lines2023.xlsx file to Oracle Analytics to create a dataset table.

  1. Sign in to Oracle Analytics.
  2. On the Home page, click Create, and then click Dataset.
  3. In Create Dataset, click Drop data file here or click to browse, select the sample_order_lines2023.xlsx file, and then click Open.
  4. In Create Dataset Table from sample_order_lines2023.xlsx, click OK. Click Save Save icon.
  5. In Save Dataset As, enter sample_order_lines2023, and then click OK.


    Description of sample_order_lines2023.png follows
    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.

  1. Click Create Workbook.
  2. In the workbook, click Parameters Parameters icon.
  3. Click Add Add icon. In Create Parameter, enter Dimensions in Name. Use Text as the Data Type.
  4. In Available Values, select Value. In the Value field, enter Order Priority.
  5. Click Add Value Add icon. In Value, enter City.
  6. Click Add Value Add icon. In Value, enter Customer Segment.
  7. Click Add Value Add icon. In Value, enter Product Name.
  8. In Initial Value with Value as the option, enter Order Priority. Click OK.
  9. Click Save Save icon. 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.

  1. In the workbook, click Parameters Parameters icon.
  2. Click Add Add icon. In Create Parameter, enter Measures in Name. In the Data Type row, click Integer, and then click Text.
  3. In Avaliable Values, select Value. In the Value field, enter Sales.
  4. Click Add Value Add icon. In Value, enter Profit.
  5. Click Add Value Add icon. In Value, enter Discount.
  6. Click Add Value Add icon. In Value, enter Gross Unit Price.
  7. Click Add Value Add icon. In Value, enter Shipping Cost.
  8. In Initial Value with Value as the option, enter Sales. Click OK.
  9. Click Save Save icon

Create a Visualization

In this section, you create a bar visualization.

  1. Click Data Data panel icon. 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.
  2. In the Sales by Order Priority bar visualization, click Menu Menu icon, select Sort By, select Sales, and then select High to Low.


    Description of sales_bar_viz.png follows
    Description of the illustration sales_bar_viz.png
  3. Click Save Save icon

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.

  1. Click Visualizations Visualizations tab icon.
  2. Scroll to Dashboard Controls, select Dashboard Filters Dashboard filters icon and drag it to the canvas, and then release it above the Sales by Order Priority visualization.
  3. Click Parameters Parameters icon.
  4. In the Parameters panel, select the Dimensions parameter and drag it to Filter Controls in the Grammar Grammar panel icon panel.
  5. In the Parameters panel, select the Measures parameter, and drag it to Filter Controls in the Grammar Grammar panel icon panel.


    Description of parameters_in_dashboard.png follows
    Description of the illustration parameters_in_dashboard.png
  6. Click Save Save icon

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.
  1. Select the Dashboard Filter visualization.
  2. Click Data Data panel icon. In the Data panel, right-click My Calculations, and then click Add Calculation.
  3. In New Calculation, enter Dimension X-axis in Name.
  4. In the expression field, enter case. Click Parameter Parameters icon, select and drag the Dimensions parameter to the expression field.


    Description of drag_dim_param_calc.png follows
    Description of the illustration drag_dim_param_calc.png
  5. In the @parameter("Dimensions")(default value) field, enter 'Order Priority'. After the default value, enter when 'Order Priority' then enter ord and select Order Priority.
  6. 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 dimensions_calc.png follows
    Description of the illustration dimensions_calc.png
  7. Click Validate and then click Save.
  8. Click the bar visualization. Drag Dimension X-axis to Category (X-axis) to replace Order Priority in the Grammar panel.
  9. Select City from the Dimensions list.


    The bar visualization shows the change to city on the X-axis.

    Description of dim_wired_2_viz.png follows
    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.

  1. Select the Dashboard Filter visualization.
  2. Click Data Data panel icon. In the Data panel, right-click My Calculations, and then click Add Calculation.
  3. In New Calculation, enter Measure Y-axis in Name.
  4. In the expression field, enter case. Click Parameter Parameters icon, select and drag the Measures parameter to the expression field.
  5. In the @parameter("Measures")(default value) field, enter 'Sales'. After the default value, enter when 'Sales' then enter sal and select Sales.
  6. 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 measure_calc.png follows
    Description of the illustration measure_calc.png
  7. Click Validate and then click Save.
  8. Click the bar visualization. Drag Measure Y-axis to Category (Y-axis) to replace Sales in the Grammar panel.
  9. In the dashboard filter, select Profit from the Measures list.


    The bar visualization shows the change to profit on the Y-axis.

    Description of city_profit_vis.png follows
    Description of the illustration city_profit_vis.png
  10. Click Save Save icon.

Review the Column Selector Workbook

  1. Click Go back Go back icon.
  2. On the Home page, hover over the Column Selector workbook, click Actions Actions menu icon, and then select Open.


    Description of default_column_selections.png follows
    Description of the illustration default_column_selections.png
  3. Select a Dimension to view the change in the visualization.
  4. Select a Measure to view the change in the visualization.

Learn More