Before You Begin
In this tutorial, you learn how to create a date part parameter that enables interacting with the workbook to select a date part that filters the dataset.
Background
Date parts are the year, month, or year-month portion of a date value such as ship date, order date, and other date columns. You might want to filter the data to find the sales related to ship dates in a specific year and sales related to orders in that same time period.
This tutorial shows sales by order date and sales by ship date to demonstrate how to pass a value between separate visualizations with different date columns. You create expression filters in the visualizations, and enable users to select the date part parameter in a dashboard filter control.
What Do You Need?
- Access to Oracle Analytics
- Download sample_order_lines.xlsx to your computer
Create a Dataset
In this section, you add the sample_order_lines.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_lines.xlsx file, and then click Open.
- In Create Dataset Table from sample_order_lines.xlsx, click OK. Click Save .
- In Save Dataset As, enter
sample_order_lines
, and then click OK.
Create Visualizations
In this section, you create two visualizations. Each visualization uses Sales with different date columns, Ship Date and Order Date.
- Click Create Workbook.
- In the Data pane, hold down the Ctrl key, select Sales, expand Ship Date and select Month, and then drag the data elements to the canvas.
Oracle Analytics automatically creates a line visualization of the data.
- In the Data pane, hold down the Ctrl key, select Sales, expand Order Date and select Month.
- Drag the data elements to the canvas and then release them next to or above the Sales by Ship Date visualization.
Create a Date Part Parameter
In this section, you create a parameter for the date part. This parameter doesn't accept multiple values or use an alias.
- In the workbook, click Parameters .
- In the Parameters pane, click Add Parameter .
- In Create Parameter, enter
Year
in Name. - In the Data Type row use the default value, Text.
- From the Available Values list, select Value.
- In the Value field, enter
2013
. Click Add Value . In the Value field enter2014
. - Click Add Value three more times to add three fields. In those fields, enter
2015
,2016
, and2017
(one value per field). - In the Initial Value field, enter
2014
. - Click OK.
The Year parameter appears in the Parameters pane.
Create Filter Expressions
In this section, you create filter expressions for the Order Date and Ship Date visualizations. The expression uses the CAST function to extract year from the date and compare the value with the Year parameter.
- In the workbook filter bar, click Add Filter and select Add Expression Filter.
- In Expression Filter, enter
Ship
in Label. - In the Expression field, enter
cas
and select CAST. - In the parentheses, enter
Yea
to replace expression, and select Year. In dimension, enterShi
and select Ship Date. - After AS, enter
varchar(4)
, and then enter equals =. - Click Parameters . Drag the Year parameter to the expression after the equals sign. In default value, enter
'2014'
. Click Validate. Click Apply.Your expression should like similar to
CAST(YEAR(Ship Date) AS varchar(4)) = @parameter("Year")('2014')
.The Ship expression filter updates both visualizations with parameter's initial value year of 2014.
- In the workbook filter bar, click Add Filter and select Add Expression Filter.
- In Expression Filter, enter
Order
in Label. In the Expression field, entercas
and select CAST. - In the parentheses, enter
Yea
to replace expression, and select Year. In dimension, enterOrd
and select Order Date. - After AS, enter
varchar(4))
, and then enter equals =. Click Parameters . Drag the Year parameter to the expression after the equals sign. In default value, enter'2014'
. Click Validate. Click Apply.Your expression should like similar to
CAST(YEAR(Order Date) AS varchar(4)) = @parameter("Year")('2014')
.
Add the Parameter as a Dashboard Filter Control
- Click Visualizations .
- Under Dashboard Control, drag Dashboard Filters to the canvas.
- Click Parameters. Drag the Year parameter to the Dashboard Filters visualization.
- In the Dashboard Filters control, click Year and select 2016.
- Click Save. In Save Workbook, enter a Name and click Save.
- Click Go back .
- On the Home page, open the workbook. Select a Year to update the visualizations.
In the consumer view, the date part filter uses the initial value of 2014.
Learn More
Create a Date Part Parameter in Oracle Analytics
F80470-02
May 2024
Learn how to create a date part parameter 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.