# OLAP

# OLAP example

We have a solution

- Change management \[changemanagement\]

The solution contains the following lookup fields

- Scope \[TYPE\]
- Type \[TASKTYPE\]

It also has some decimal values

- Estimate \[ESTIMATE\]
- Realized \[REALIZED\]

In our reporting we want to see distributions by

- A period hierarchy: Year / Quarter / Month
- Categories by Scope, Type and Status

## <span class="mw-headline" id="bkmrk-setting-up-the-cube-1">Setting up the cube</span>

A new OLAP cube is set up in: "Integration" &gt; "OLAP cubes" &gt; "Add"

### <span class="mw-headline" id="bkmrk-basic-information-1">Basic information</span>

- Name display: sample1
- Cube header: Report sample1

### <span id="bkmrk-"></span><span class="mw-headline" id="bkmrk-cube-definition-%28%22cu-1">Cube definition ("Cube Schema XML")</span>

For further help to designing schemas please refer to the following ressources

- [http://mondrian.pentaho.com/documentation/schema.php](http://mondrian.pentaho.com/documentation/schema.php)

```xml
<Cube name="sample1cube">
  <Table name="data_changemanagement"/>
  <Dimension name="Scope" foreignKey="TASKTYPE">
    <Hierarchy hasAll="true" primaryKey="LookupID">
    <Table name="formfieldlookup"/>
      <Level name="Type" column="Value" uniqueMembers="true"/>
    </Hierarchy>
  </Dimension>
  <Dimension name="Type" foreignKey="TYPE">
    <Hierarchy hasAll="true" primaryKey="LookupID">
    <Table name="formfieldlookup"/>
      <Level name="Type" column="Value" uniqueMembers="true"/>
    </Hierarchy>
  </Dimension>
  <Dimension name="Status" foreignKey="StatusID">
    <Hierarchy hasAll="true" primaryKey="StatusID">
    <Table name="formstatus"/>
      <Level name="Type" column="Status" uniqueMembers="true"/>
    </Hierarchy>
  </Dimension>
  <Dimension name="Period" type="TimeDimension">
    <Hierarchy name="Periode" hasAll="true" allMemberName="All period">
      <Table name="data_changemanagement"/>
      <Level name="Aar" levelType="TimeYears" uniqueMembers="true">
        <KeyExpression>
          <SQL dialect="mysql">Year(CreatedAt)</SQL>
          <SQL dialect="generic">YEAR</SQL>
        </KeyExpression>
      </Level>
      <Level name="Kvartal" uniqueMembers="false" levelType="TimeQuarters">
        <KeyExpression>
          <SQL dialect="mysql">Quarter(CreatedAt)</SQL>
          <SQL dialect="generic">Quarter</SQL>
        </KeyExpression>
      </Level>
      <Level name="Maaned" uniqueMembers="false" levelType="TimeMonths">
        <KeyExpression>
          <SQL dialect="mysql">Month(CreatedAt)</SQL>
          <SQL dialect="generic">Month</SQL>
        </KeyExpression>
      </Level>
    </Hierarchy>
  </Dimension>
  <Measure name="Revision" column="Revision" aggregator="sum" formatString="Standard"/>   
  <Measure name="Estimate" column="ESTIMATTIMER" aggregator="sum" formatString="Standard"/>   
  <Measure name="Realized" column="REALISERETTIMER" aggregator="sum" formatString="Standard"/>   
</Cube>
```

### <span id="bkmrk--1"></span><span class="mw-headline" id="bkmrk-mdx-query-%28%22cube-que-1">MDX query ("Cube Query MDX")</span>

For further help to designing queries please refer to the following ressources

- [http://technet.microsoft.com/en-us/library/ms145971.aspx](http://technet.microsoft.com/en-us/library/ms145971.aspx)

```mysql
SELECT
  NON EMPTY {([Measures].[Estimate],[Measures].[Realized])} ON COLUMNS,
  NON EMPTY {([Period],[Type],[Status])} ON ROWS
FROM [sample1cube]
```

## <span class="mw-headline" id="bkmrk-results-1">Results</span>

The cube is acccesed via this URL (or press "test" form the OLAP overview) [http://YOUR\_DOMAIN/TempusServa/olapview.jsp?query=sample1](http://your_domain/TempusServa/olapview.jsp?query=sample1)

[![image.png](https://docs.tsnocode.com/uploads/images/gallery/2025-04/scaled-1680-/DT1uGurX8iq4UTEA-image.png)](https://docs.tsnocode.com/uploads/images/gallery/2025-04/DT1uGurX8iq4UTEA-image.png)

[![image.png](https://docs.tsnocode.com/uploads/images/gallery/2025-04/scaled-1680-/RdSDIs4HYtgV3pWL-image.png)](https://docs.tsnocode.com/uploads/images/gallery/2025-04/RdSDIs4HYtgV3pWL-image.png)

# Schema cheatsheet

## <span class="mw-headline" id="bkmrk-introduction-1">Introduction</span>

The below paragraphs contains sample snippets for your OLAP schema.

Precise documentation on how to define a schema, can be found at: [http://mondrian.pentaho.com/documentation/schema.php](http://mondrian.pentaho.com/documentation/schema.php)

## <span class="mw-headline" id="bkmrk-schema-structure-ove-1">Schema structure overview</span>

- Table (one): 
    - Structure: The centre table containing the measures (FACT table)
    - OLAP cube: *Not displayed*

- Dimensions (many) 
    - Structure: Related tables or groupable values (FACT table relations)
    - OLAP cube: Columns/row "headers" in the cube

- Measures (many) 
    - Structure: Values found in the centre table (FACT table values)
    - OLAP cube: Numbers to be displayed in the table cells

## <span class="mw-headline" id="bkmrk-defining-dimensions--1">Defining dimensions for related values</span>

### <span class="mw-headline" id="bkmrk-standard-lookup-valu-1">Standard lookup value</span>

The cube schema below only needs adjustment for the system name of the lookup field.

**Structure**

<table id="bkmrk-solution-as-displaye"><tbody><tr><td>Solution as displayed</td><td>"Sample solution" : "Category" = xxx</td></tr><tr><td>Solution system names</td><td>sample : CATEGORY = xxx</td></tr><tr><td>Database table names</td><td>data\_sample : CATEGORY = xxx</td></tr></tbody></table>

**Data model**

- data\_sample 
    - CATEGORY: Field containing the lookup value

**Cube schema**

```xml
...
<Dimension name="Example" foreignKey="CATEGORY">
   <Hierarchy hasAll="true" primaryKey="LookupID">
      <Level name="Category" column="Value" uniqueMembers="true" />
   </Hierarchy>
</Dimension>
...
```

### <span class="mw-headline" id="bkmrk-simple-choice-value-1">Simple choice value</span>

The cube schema below only needs adjustment for the system name of the lookup field.

**Structure**

<table id="bkmrk-solution-as-displaye-1"><tbody><tr><td>Solution as displayed</td><td>"Sample solution" : "My choice" = xxx</td></tr><tr><td>Solution system names</td><td>sample : CHOICE = xxx</td></tr><tr><td>Database table names</td><td>data\_sample : CHOICE = xxx</td></tr></tbody></table>

**Data model**

- data\_sample 
    - CHOICE: Field containing the lookup value

**Cube schema**

```xml
...
<Dimension name="Example" foreignKey="CHOICE">
   <Hierarchy hasAll="true" primaryKey="ChoiceID">
      <Level name="Answer" column="Value" uniqueMembers="true" />
   </Hierarchy>
</Dimension>
...
```

### <span class="mw-headline" id="bkmrk-standard-record-stat-1">Standard record Status</span>

The cube schema below can be copied directly without modification: The status properties and tablenames are allways the same.

**Structure**

<table id="bkmrk-solution-as-displaye-2"><tbody><tr><td>Solution as displayed</td><td>"Sample solution" : "Status" = xxx</td></tr><tr><td>Solution system names</td><td>sample : "StatusID" = xxx</td></tr><tr><td>Database table names</td><td>data\_sample "StatusID" = xxx</td></tr></tbody></table>

**Data model**

- data\_sample 
    - StatusID: Field containing status reference (allways the same)

**Cube schema**

```xml
...
<Dimension name="Example" foreignKey="StatusID">
   <Hierarchy hasAll="true" primaryKey="StatusID">
      <Level name="Status" column="Status" uniqueMembers="true" />
   </Hierarchy>
</Dimension>
...
```

## <span class="mw-headline" id="bkmrk-defining-dimensions--3">Defining dimensions for related records</span>

### <span class="mw-headline" id="bkmrk-related-solution-one-1">Related solution ONE step away</span>

**Structure**

<table id="bkmrk-solutions-as-display"><tbody><tr><td>Solutions as displayed</td><td>"Some child" : "Parent" -&gt; "Father or mother"</td></tr><tr><td>Solution system names</td><td>child : PARENT -&gt; parent</td></tr><tr><td>Database table names</td><td>data\_child : PARENT -&gt; data\_parent</td></tr></tbody></table>

**Data model**

- data\_child 
    - PARENT: Key to the "parent" solution
- data\_parent 
    - GRANDPARENT: Key to the "grandparent" solution
    - PARENTNAME: Descriptive field

**Cube schema**

```xml
...
<Dimension name="Example" foreignKey="PARENT">
   <Hierarchy hasAll="true" primaryKey="DataID" primaryKeyTable="data_parent">
      <Level name="Parent" column="PARENTNAME" uniqueMembers="true" />
   </Hierarchy>
</Dimension>
...
```

### <span class="mw-headline" id="bkmrk-related-solution-two-1">Related solution TWO steps away</span>

Note that the schemas for multi join tables are written from "inside out", that might seem counterintuitive i relation to what you want to display in the cube later.

**Structure**

<table id="bkmrk-solutions-as-display-1"><tbody><tr><td>Solutions as displayed</td><td>"Some child" : "Parent" -&gt; "Father or mother" : "Grand parent" -&gt; "Grandma and Grandpa's"</td></tr><tr><td>Solution system names</td><td>child : PARENT -&gt; parent : GRANDPARENT -&gt; grandparent</td></tr><tr><td>Database table names</td><td>data\_child : PARENT -&gt; data\_parent : GRANDPARENT -&gt; data\_grandparent</td></tr></tbody></table>

**Data model**

- data\_child 
    - PARENT: Key field pointing to the "parent" solution

- data\_parent 
    - GRANDPARENT: Key field pointing to the "grandparent" solution
    - PARENTNAME: Descriptive field

- data\_grandparent 
    - GRANDPARENTNAME: Descriptive field

**Cube schema**

```xml
...
<Dimension name="Example" foreignKey="PARENT">
   <Hierarchy hasAll="true" primaryKey="DataID" primaryKeyTable="data_parent">
      <Join leftKey="GRANDPARENT" rightKey="DataID" />
      <Level name="Grandparent" table="data_grandparent" column="GRANDPARENTNAME" uniqueMembers="true" />
      <Level name="Parent" table="data_parent" column="PARENTNAME" uniqueMembers="true" />
   </Hierarchy>
</Dimension>
...
```

## <span class="mw-headline" id="bkmrk-defining-dimensions--5">Defining dimensions for inline values</span>

### <span class="mw-headline" id="bkmrk-text-values-1">Text values</span>

**Cube schema**

```xml
 ...
 <Dimension name="Category">
     <Hierarchy hasAll="true">
         <Level name="Name" column="NAME" uniqueMembers="true"/>
     </Hierarchy>
 </Dimension>
 ...
```

### <span id="bkmrk-"></span><span class="mw-headline" id="bkmrk-year%2Finteger-values-1">Year/integer values</span>

**Cube schema**

```xml
 ...
 <Dimension name="Period" type="TimeDimension">
     <Hierarchy hasAll="true">
         <Level name="Aar" column="YEAR" type="Numeric" uniqueMembers="false" levelType="TimeYears"/>
     </Hierarchy>
 </Dimension>
 ...
```

### <span id="bkmrk--1"></span><span class="mw-headline" id="bkmrk-date-%2F-datetime-valu-1">Date / datetime values</span>

**Cube schema**

```xml
...
<Dimension name="Period" type="TimeDimension">
   <Hierarchy name="Periode" hasAll="true" allMemberName="All period">
      <Level name="Aar" levelType="TimeYears" uniqueMembers="true">
         <KeyExpression>
            <SQL dialect="mysql">Year(CreatedAt)</SQL>
            <SQL dialect="generic">YEAR</SQL>
         </KeyExpression>
      </Level>
      <Level name="Maaned" uniqueMembers="false" levelType="TimeMonths">
         <KeyExpression>
            <SQL dialect="mysql">Month(CreatedAt)</SQL>
            <SQL dialect="generic">Month</SQL>
         </KeyExpression>
      </Level>
   </Hierarchy>
</Dimension>
...
```

### <span class="mw-headline" id="bkmrk-enumeration-values-1">Enumeration values</span>

**Cube schema**

```xml
 ...
 <Dimension name="Severity">
     <Hierarchy hasAll="true" primaryKey="SEVERITY">
         <InlineTable alias="enumeration">
         <ColumnDefs>
             <ColumnDef name="id" type="Numeric"/>
             <ColumnDef name="desc" type="String"/>
         </ColumnDefs>
         <Rows>
             <Row>
                 <Value column="id">1</Value>
                 <Value column="desc">High</Value>
             </Row>
             <Row>
                 <Value column="id">2</Value>
                 <Value column="desc">Medium</Value>
             </Row>
             ... more values ...
        </Rows>
     </InlineTable>
     <Level name="Severity" column="id" nameColumn="desc" uniqueMembers="true"/>
 </Hierarchy>
 </Dimension>
 ...
```

## <span class="mw-headline" id="bkmrk-defining-measures-1">Defining measures</span>

### <span class="mw-headline" id="bkmrk-normal-values-1">Normal values</span>

Measures are allways numeric values, that can be agggated to higher levels (the levels in the dimensions)

<table id="bkmrk-type-aggregator-exam"><tbody><tr><th>Type</th><th>Aggregator</th><th>Examples</th></tr><tr><td>Sums</td><td>SUM</td><td>Time spent, costs</td></tr><tr><td>Average</td><td>AVG</td><td>Process time</td></tr></tbody></table>

  
**Cube schema**

### <span class="mw-headline" id="bkmrk-calculated-values-1">Calculated values</span>

# Analyse Activity

User activity will display an OLAP cube for **changes and updates** to certain solutions.

Changes are defined by updates to the underlying record.

## <span class="mw-headline" id="bkmrk-how-to-activate-this-1">How to activate this feature</span>

- User must have the **Business analyst** property set
- The solution must have **Activity monitoring** property set
- The service **OLAP Activity** must be active

# Analyse Flowsteps

User activity will display an OLAP cube for **flow in each process step** for certain solutions.

The total flow time is defined as the time span between entry and exit point in time for each flow step (status).

Furthermore each status can have targets for good performance defined:

- Goal: Expected process time in this step
- Tolerance: Acceptable process time in this step

## <span class="mw-headline" id="bkmrk-how-to-activate-this-1">How to activate this feature</span>

- User must have the **Business analyst** property set
- The solution must have **Activity monitoring** property set
- The service **OLAP Flowsteps** must be active

# Analyse Flowtotal

User activity will display an OLAP cube for **total flow** time to certain solutions.

The total flow time is defined as the time span between creation and point in time where a final status i reached.

Furthermore each solution can have targets for good performance defined:

- Goal: Expected total process time
- Tolerance: Acceptable total process time

## <span class="mw-headline" id="bkmrk-how-to-activate-this-1">How to activate this feature</span>

- User must have the **Business analyst** property set
- The solution must have **Activity monitoring** property set
- The service **OLAP Flow total** must be active