C10 Build Repositories

Embed Size (px)

Citation preview

  • 8/10/2019 C10 Build Repositories

    1/11

    Page 1

    Creating Time Series Comparison Measures

    Goal

    To create time series calculation measures using Oracle BI time series functions

    Scenario

    You use the Oracle BI time series functions to create new measures to enable users to comparecurrent dollar performance to previous time periods. You then add the new measures to thepresentation catalog and test the measures using analyses.

    Time series functions include AGO, TODATE, and PERIODROLLING. These functions let youuse Expression Builder to call a logical function to perform time series calculations instead ofaliasing physical tables and modeling logically. The time series functions calculate AGO,TODATE, and PERIODROLLING functions based on the calendar tables in your datawarehouse, not on standard SQL date manipulation functions.

    Time

    25 minutes

    Background

    The ability to compare business performance with previous time periods is fundamental tounderstanding a business. Yet, as Ralph Kimball states, SQL was not designed to makestraightforward comparisons over time:

    The most difficult area of data warehousing is the translation of simple business analyses intoSQL. SQL was not designed with business reports in mind. SQL was really an interim languagedesigned to allow relational table semantics to be expressed in a convenient and accessibleform, and to enable researchers and early developers to proceed with building the first relationalsystems in the mid-1970s. How else can you explain the fact that there is no direct way in SQLto compare this year to last year? Ralph Kimball

    Tasks1. In the SupplierSales business model, set the Time logical dimension as a time dimension.

    a. Return to the Administration Tool, which should still be open, and open the ABCrepository in offline mode with repository password welcome1.

    b. In the SupplierSales business model, double-click the Timelogical dimension.

    c. On the General tab, select the Timecheck box. Time series functions operate on time-oriented dimensions. To use these functions on a particular dimension, you must

  • 8/10/2019 C10 Build Repositories

    2/11

    Page 2

    designate the dimension as a Time dimension.

    d. Click OKto close the dialog box.

    2. Remove the logical key created for the Dim_MONTHS_AGG logical table source. Thisprevents consistency check errors related to hierarchy levels.

    a. Double-click Dim-Timeto open the Logical Table dialog box.

    b. Click the Keystab.c. Select Dim_MONTHS_AGG_Key. This is a new logical key that was created when you

    created the Dim_MONTHS_AGG logical table source.

    d. Click Delete(the red X) to delete the key. This will prevent consistency check errorswhen you map a key column to a hierarchy level that is higher than the level with thedetail key.

    e. ClickYesto confirm the deletion.

    f. Click OKto close the Logical Table dialog box.

    3. Add MonthCode to the Month level in the Time logical dimension.

    a. Expand the Dim-Timelogical table.

    b. Expand the Timelogical dimension.

    c. Drag Month Codefrom the Dim-Timelogical table to the Monthlevel in the Timelogical dimension.

    d. Right-click the Month Codelevel column and select New Logical Level Keyto openthe Logical Level Key dialog box.

  • 8/10/2019 C10 Build Repositories

    3/11

    Page 3

    e. Deselect Use for displayand click OK.

    4. Identify level keys as chronological keys. It is best practice to designate a chronological keyfor every level of a time dimension hierarchy.

    a. Double-click the Monthlevel to open the Logical Level dialog box.

    b. Click the Keystab.

    c. Select the Chronological Keycheck box for Month Code.

    d. Set Month Codeas the primary key.

    e. Click OKto close the Logical Level dialog box.

    f. Repeat and set chronological keys for the remaining levels:Time Detail: DayQuarter: Quarter

    Year: Year

    5. Create a measure that calculates dollars for the previous month by using the AGO function.

    a. Right-click the Fact-Saleslogical table and select New Object > Logical Column.

    b. On the General tab, name the column Month Ago Dollars.

    c. On the Column Sourcetab, select Derived from existing columns using anexpression.

  • 8/10/2019 C10 Build Repositories

    4/11

    Page 4

    d. Click the Edit Expressionbutton to open the Expression Builder.

    e. Select Functions > Time Series Functions > Ago.

    f. Click Insert selected itemto add the Ago function to the Expression Builder.

    g. Click in the expression.

    h. Select Logical Tables > Fact-Salesand then double-click Dollarsto add it to theexpression.

    i. Click in the expression.

    j. Select Time Dimensions > Timeand then double-click Monthto add it to theexpression.

  • 8/10/2019 C10 Build Repositories

    5/11

    Page 5

    k. Click and enter 1. The Ago function calculates the Dollarsvalue one month before the current month.

    l. Click OKto close the Expression Builder.

    m. Check your work.

    n. Click OKto close the Logical Column dialog box.

    o. Drag the Month Ago Dollarslogical column to the Fact-Salespresentation table.

    6. Create a measure that calculates the difference in dollars between the current month andthe previous month.

    a. Right-click the Fact-Saleslogical table and select New Object > Logical Column.

    b. On the General tab, name the new logical column Change Month Ago Dollars.

    c. On the Column Source tab, select Derived from existing columns using anexpression.

    d. Open the Expression Builder.

    e. Select Logical Tables > Fact-Salesand then double-click Dollarsto add it to theexpression.

    f. Insert a minus sign.

    g. Select Logical Tables > Fact-Salesand then double-click Month Ago Dollars.

    h. Click OKto close the Expression Builder.

  • 8/10/2019 C10 Build Repositories

    6/11

  • 8/10/2019 C10 Build Repositories

    7/11

  • 8/10/2019 C10 Build Repositories

    8/11

    Page 8

    k. Check your work.

    l. Click OKto close the Logical Column dialog box.

    m. Drag theYear To Date Dollarslogical column to the Fact-Sales presentation table.

    9. Create a measure that calculates a three period rolling sum for dollars using thePERIODROLLING function.

    a. Right-click Fact-Salesand select New Object > Logical Column.

    b. On the General tab, name the logical column Dollars 3-Period Rolling Sum.

    c. On the Column Source tab, select Derived from existing columns using anexpression.

    d. Open the Expression Builder.

    e. Select Functions > Time Series Functionsand then double-click PeriodRollingtoinsert the expression.

    f. Click .

    g. Select Logical Tables > Fact-Salesand then double-click Dollarsto add it to theexpression.

    h. Click .

    i. Enter -2. This identifies the first period in the rolling aggregation.

    j. Click .

    k. Enter 0. This identifies the last period in the rolling aggregation. These integers are therelative number of periods from a displayed period. In this example, if the query grain is

  • 8/10/2019 C10 Build Repositories

    9/11

    Page 9

    month, the three-month rolling sum starts two months in the past (-2) and includes thecurrent month (0).

    l. Click OKto close the Expression Builder.

    m. Check your work.

    n. Click OKto close the Logical Column dialog box.

    o. Drag the Dollars 3-Period Rolling Sumlogical column to the Fact-Sales presentationtable.

    10. Create a measure that calculates a three-period rolling average for dollars.

    a. Right-click Fact-Salesand select New Object > Logical Column.

    b. On the General tab, name the logical column Dollars 3-Period Rolling Avg.

    c. On the Column Source tab, select Derived from existing columns using anexpression.

    d. Open the Expression Builder.

    e. Select Logical Tables > Fact-Salesand then double-click Dollars 3-Period RollingSum to add it to the expression.

    f. Divide the column by 3.

    g. Click OKto close the Expression Builder.

  • 8/10/2019 C10 Build Repositories

    10/11

    Page 10

    h. Check your work.

    i. Click OKto close the Logical Column dialog box.

    j. Drag the Dollars 3-Period Rolling Avglogical column to the Fact-Sales presentationtable.

    k. Save the repository.

    l. Check consistency. Fix errors or warnings, if any, before you proceed.

    m. Close the repository.

    n. Leave the Administration Tool open.

    11. Create analyses to check your work for the AGO and TODATE functions.

    a. Use Fusion Middleware Control to upload the ABC repository and restart Oracle BIcomponents. If you need help, refer to steps from earlier practices.

    b. Sign in to Analysis Editor as weblogic/welcome1.

    c. Create the following analysis and filter:

    Note: Change the Dollars* columns data format to currency and the Percentagecolumn data format to percentage.

  • 8/10/2019 C10 Build Repositories

    11/11

    Page 11

    d. Click Results. Your results should look similar to the screenshot:

    e. Note that Monthis sorted automatically based on the MonthCode sort-order columnthat you set in the repository.

    12. Create analyses to check your work for the PERIODROLLING function.

    a. Create the following analysis and filter:

    b. Click Results:

    c. Create a similar analysis and filter for Quarter and check the results.

    The PERIODROLLING measures display results based on the query grain.

    d. Sign out of Oracle BI.