Skip to main content

Adding Time Levels

Adding Time Levels

In this part of the tutorial, we add time levels to the cube.

The Patients class includes the patient’s birth date in several forms (so that you can try different formats with Business Intelligence):

Property BirthDate As %Date;

Property BirthDateTimeStamp As %TimeStamp;

Business Intelligence has built-in support for all three of these formats, as well as for $HOROLOG format and others (for details, see Defining Models for InterSystems Business Intelligence).

The class also includes the patient’s birth time, as part of the BirthDateTimeStamp property or as the following property:

Property BirthTime As %Time;

The most flexible property is BirthDateTimeStamp, because it contains both the birth date and the birth time, so we will use that as the basis for the time levels.

  1. Access the Architect and display the Tutorial cube.

  2. Click Add Element.

  3. For Enter New Element Name, type BirthD.

  4. Click Time Dimension.

  5. Click OK.

    The system creates a dimension, hierarchy, and level.

  6. Make the following change to the dimension:

    • Click the search button next to Property, click BirthDateTimeStamp, and click OK.

  7. Make the following changes to the level:

    • Rename the level to Year.

    • For Extract value with function, select Year.

      This option means that this level is based only the patients’ birth years.

  8. Add another level as follows:

    1. Click the hierarchy H1 in this dimension.

    2. Click Add Element.

    3. For Enter New Element Name, type Month Year.

    4. Click Level.

    5. Click OK.

      The system creates a new level in the hierarchy H1, after the existing Year level.

  9. For the Month Year level, make the following change:

    • For Extract value with function, select MonthYear.

      This option means that this level is based on the combined birth year and month.

  10. Add another hierarchy and level to the BirthD dimension, as follows:

    1. Click the dimension name.

    2. Click Add Element.

    3. For Enter New Element Name, type H2.

    4. Click Hierarchy.

    5. Click OK.

      The system creates a new hierarchy and level.

    6. For the new level, make the following changes:

      • Rename the level to Time.

      • For Extract value with function, select HourNumber.

        This option means that this level is based on the time of day the patient was born.

  11. Compile the cube.

    When you do so, the Architect saves the cube.

  12. Build the cube.

  13. Access the Analyzer.

    (If this is open on another browser tab, switch to that tab and click the Analytics > Analyzer link to refresh with the most current model.)

  14. Try the new levels. You should see the following:

    • When you expand Year in the left area, you see this:

      generated description: year now

      NOW is a special member that refers to the current year (in this context).

    • The Month Year level also has a NOW member, which refers to the current year and month.

    • When you use Year as rows, you should see something like this:

      generated description: years as rows

    • When you use Month Year as rows, you should see something like this:

      generated description: month years as rows

    • When you use Time as rows, you should see something like this:

      generated description: times as rows

The system does not generate tables for time levels, which have special internal handling.

FeedbackOpens in a new tab