Time Series Function are useful to evaluate and compare the business performance against time period, analyzing the data for multiple periods.
- Ago: calculates the aggregated value from the current time back to a specified time period.
Ex: Month Ago Revenue, Year Ago Revenue
Syntax: AGO(expr, [time_level], offset)
Expr is an expression that references at least one measure column.
Time_level is Level in the Time Hierarchy, such as quarter, month, or year.
Offset is an integer literal that represents the time shift amount.
- ToDate: aggregates a measure attribute from the beginning of a specified time period to the current time
Ex: Year To Date Revenue (YTD), Mont To Date Revenue ( MTD)
Syntax: TODATE(expr, time_level)
- Periodic Rolling: This function computes the sum of a measure over the period starting offset of time and ending offset of time from the current time
Ex: 3Month Rolling Revenue
Syntax: PERIODROLLING(expr, starting period offset [,ending period offset])
Practice: (Copied from Oracle Tutorial)
Practice: (Copied from Oracle Tutorial)
Identifying a Logical Dimension as a Time Dimension
- Return to the Administration Tool and open the BISAMPLE repository in offline mode.
- In the BMM layer, double-click the H1 Time logical dimension to open the Logical Dimension dialog box.
- In the Structure section, select Time.
Time series functions operate on time-oriented dimensions. To use these functions on a particular dimension, you must designate the dimension as a Time dimension.
- Click OK to close the Logical Dimension dialog box.
Identifying Level Keys as Chronological Keys
- Expand the H1 Time logical dimension and double-click the Time Detail level to open the Logical Level dialog box.
- Click the Keys tab.
- Select the Chronological Key check box for Calendar Date.
- Click OK to close the Logical Level dialog box.
- Repeat and set chronological keys for the following levels:
Logical Level
|
Chronological Key
|
Year
|
Per Name Year
|
Half
|
Per Name Half
|
Quarter
|
Per Name Qtr
|
Month
|
Per Name Month
|
Week
|
Per Name Week
|
- It is best practice to designate a chronological key for every level of a time logical dimension.
Creating a Measure Using the AGO Function
- Right-click the F1 Revenue logical table and select New Object > Logical Column.
- On the General tab, name the column Month Ago Revenue.
- On the Column Source tab, select "Derived from existing columns using an expression".
- Open the Expression Builder.
- Select Functions > Time Series Functions > Ago.
- Double-click Ago or click Insert selected item to add the Ago function to the Expression Builder.
- Click <<Measure>>in the expression.
- Select Logical Tables > F1 Revenue and then double-click Revenue to add it to the expression.
- Click <<Level>> in the expression.
- Select Time Dimensions > H1 Time and then double-click Month to add it to the expression.
- Click <<Number of Periods>> and enter 1. The Ago function will calculate the Revenue value one month before the current month.
- Click OK to close the Expression Builder. Check your work in the Logical Column dialog box:
- Click OK to close the Logical Column dialog box. The Month Ago Revenue time series measure is added to the F1 Revenue logical table.
- Drag the Month Ago Revenue logical column to the Base Facts presentation folder.
Creating a Measure Using the TODATE Function
- Right-click the F1 Revenue logical table and select New Object > Logical Column.
- On the General tab, name the new logical column Year To Date Revenue.
- On the Column Source tab, select "Derived from existing columns using an expression".
- Open the Expression Builder.
- Select Functions > Time Series Functions and double-click ToDate to insert the expression.
- Click <<Measure>> in the expression.
- Select Logical Tables > F1 Revenue and then double-click Revenue to add it to the expression.
- Click <<Level>> in the expression.
- Select Time Dimensions > H1 Time and then double-click Year to add it to the expression.
- Click OK to close the Expression Builder.
- Check your work in the Logical Column dialog box.
- Click OK to close the Logical Column dialog box.
- Drag the Year To Date Revenue logical column to the Base Facts presentation folder.
Creating a Measure Using the PERIODROLLING Function
- Right-click the F1 Revenue logical table and select New Object > Logical Column.
- On the General tab, name the new logical column Revenue 3-Period Rolling Sum.
- On the Column Source tab, select "Derived from existing columns using an expression".
- Open the Expression Builder.
- Select Functions > Time Series Functions and double-click PeriodRolling to insert the expression.
- Click <<Measure>> in the expression.
- Select Logical Tables > F1 Revenue and then double-click Revenue to add it to the expression.
- Click <<Starting Period Offset>> in the expression.
- Enter -2. This identifies the first period in the rolling aggregation.
- Click <<Ending Period Offset>>.
- Enter 0. This identifies the last period in the rolling aggregation.
These integers are the relative number of periods from a displayed period. In this example, if the query grain is month, the 3 month rolling sum starts two months in the past (-2) and includes the current month (0).
- Click OK to close the Expression Builder.
- Check your work in the Logical Column dialog box.
- Click OK to close the Logical Column dialog box.
- Drag the Revenue 3-Period Rolling Sum logical column to the Base Facts presentation folder.
- Save the repository and check consistency. Fix any errors or warnings before you proceed.
- Close the repository. Leave the Administration Tool open.
Testing Your Work
- Return to Oracle Enterprise Manager and load the BISAMPLE repository.
- Return to Oracle BI and sign in.
- Create the following analysis to test AGO and TODATE functions:
Time.Per Name Month
Time.Per Name Year
Base Facts.Revenue
Base Facts.Month Ago Revenue
Base Facts.Year to Date Revenue
Time.Per Name Year
Base Facts.Revenue
Base Facts.Month Ago Revenue
Base Facts.Year to Date Revenue
- Set the following filter for the analysis:
Per Name Year is equal to / is in 2008.
- For the Per Name Year column, select Column Properties > Column Format > Hide. This will prevent Per Name Year from displaying in the analysis results.
- Sort Per Name Month in ascending order.
- Click Results.
Month Ago Revenue displays revenue from the previous month. Year To Date Revenue calculates a running sum of revenue for the year on a monthly basis.
- Create the following new analysis and filter to test the PERIODROLLING function at the month grain:
Time.Per Name Month
Time.Per Name Year
Base Facts.Revenue
Base Facts.Revenue 3-Period Rolling Sum
Time.Per Name Year
Base Facts.Revenue
Base Facts.Revenue 3-Period Rolling Sum
Per Name Year is equal to / is in 2008
- For the Per Name Year column, select Column Properties > Column Format > Hide. This will prevent Per Name Year from displaying in the analysis results.
- Sort Per Name Month in ascending order.
- Click Results.
Revenue 3-Period Rolling Sum is calculated based on the month grain.
- Create the following new analysis and filter to test the PERIODROLLING function at the year grain:
Time.Per Name Year
Base Facts.Revenue
Base Facts.Revenue 3-Period Rolling Sum
Base Facts.Revenue
Base Facts.Revenue 3-Period Rolling Sum
- Sort Per Name Year in ascending order.
- Click Results.
Revenue 3-Period Rolling Sum is calculated based on the year grain. A measure with the PERIODROLLING function calculates results based on the query grain.
No comments:
Post a Comment