Difference between revisions of "Tutorial/OLAP example"

From TempusServa wiki
Jump to navigation Jump to search
old>Admin
(Created page with ' === Cube definition === <Cube name="sample1cube"> <Table name="data_changemanagement"/> <Dimension name="Scope" foreignKey="TASKTYPE"> <Hierarchy hasAll="true" primaryKe…')
 
m (20 revisions imported)
 
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Example ==


We have a solution
* Change management [changemanagement]


=== Cube definition ===
The solution contains the following lookup fields
* Scope [TYPE]
* Type [TASKTYPE]


  <Cube name="sample1cube">
It also has some decimal values
<Table name="data_changemanagement"/>
* Estimate [ESTIMATE]
<Dimension name="Scope" foreignKey="TASKTYPE">
* Realized [REALIZED]
<Hierarchy hasAll="true" primaryKey="LookupID">
 
      <Table name="formfieldlookup"/>
In our reporting we want to see distributions by
<Level name="Type" column="Value" uniqueMembers="true"/>
* A period hierachy: Year / Quarter / Month
</Hierarchy>
* Categorieres by Scope, Type and Status
</Dimension>
 
<Dimension name="Type" foreignKey="TYPE">
== Setting up the cube ==
<Hierarchy hasAll="true" primaryKey="LookupID">
 
      <Table name="formfieldlookup"/>
A new OLAP cube is set up in:
<Level name="Type" column="Value" uniqueMembers="true"/>
"Integration" > "OLAP cubes" > "Add"
</Hierarchy>
 
</Dimension>
 
<Dimension name="Status" foreignKey="StatusID">
=== Basic information ===
<Hierarchy hasAll="true" primaryKey="StatusID">
 
      <Table name="formstatus"/>
* Name display: sample1
<Level name="Type" column="Status" uniqueMembers="true"/>
* Cube header:  Report sample1
</Hierarchy>
 
</Dimension>
=== Cube definition ("Cube Schema XML") ===
<Dimension name="Period" type="TimeDimension">
 
<Hierarchy name="Periode" hasAll="true" allMemberName="All period">
For further help to designing schemas please refer to the following ressources
<Table name="data_changemanagement"/>
* http://mondrian.pentaho.com/documentation/schema.php
<Level name="Aar" levelType="TimeYears" uniqueMembers="true">
 
<KeyExpression>
<syntaxhighlight lang="xml">
<SQL dialect="mysql">Year(CreatedAt)</SQL>
<Cube name="sample1cube">
<SQL dialect="generic">YEAR</SQL>
  <Table name="data_changemanagement"/>
</KeyExpression>
  <Dimension name="Scope" foreignKey="TASKTYPE">
</Level>
    <Hierarchy hasAll="true" primaryKey="LookupID">
<Level name="Kvartal" uniqueMembers="false" levelType="TimeQuarters">
    <Table name="formfieldlookup"/>
<KeyExpression>
      <Level name="Type" column="Value" uniqueMembers="true"/>
<SQL dialect="mysql">Quarter(CreatedAt)</SQL>
    </Hierarchy>
<SQL dialect="generic">Quarter</SQL>
  </Dimension>
</KeyExpression>
  <Dimension name="Type" foreignKey="TYPE">
</Level>
    <Hierarchy hasAll="true" primaryKey="LookupID">
<Level name="Maaned" uniqueMembers="false" levelType="TimeMonths">
    <Table name="formfieldlookup"/>
<KeyExpression>
      <Level name="Type" column="Value" uniqueMembers="true"/>
<SQL dialect="mysql">Month(CreatedAt)</SQL>
    </Hierarchy>
<SQL dialect="generic">Month</SQL>
  </Dimension>
</KeyExpression>
  <Dimension name="Status" foreignKey="StatusID">
</Level>
    <Hierarchy hasAll="true" primaryKey="StatusID">
</Hierarchy>
    <Table name="formstatus"/>
</Dimension>
      <Level name="Type" column="Status" uniqueMembers="true"/>
<Measure name="Revision" column="Revision" aggregator="sum" formatString="Standard"/>   
    </Hierarchy>
<Measure name="Estimate" column="ESTIMATTIMER" aggregator="sum" formatString="Standard"/>   
  </Dimension>
<Measure name="Realized" column="REALISERETTIMER" aggregator="sum" formatString="Standard"/>   
  <Dimension name="Period" type="TimeDimension">
   </Cube>
    <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>
</syntaxhighlight>
 
=== MDX query ("Cube Query MDX") ===
 
For further help to designing queries please refer to the following ressources
* http://technet.microsoft.com/en-us/library/ms145971.aspx
 
<syntaxhighlight lang="mysql">
SELECT
  NON EMPTY {([Measures].[Estimate],[Measures].[Realized])} ON COLUMNS,
   NON EMPTY {([Period],[Type],[Status])} ON ROWS
FROM [sample1cube]
</syntaxhighlight>
 
== Results ==
 
The cube is acccesed via this URL (or press "test" form the OLAP overview)
http://YOUR_DOMAIN/TempusServa/olapview.jsp?query=sample1
 
 
[[File:Sample_olap.PNG]]
 
[[File:Sample_olap_expanded.PNG]]

Latest revision as of 11:55, 10 December 2021

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 hierachy: Year / Quarter / Month
  • Categorieres by Scope, Type and Status

Setting up the cube

A new OLAP cube is set up in: "Integration" > "OLAP cubes" > "Add"


Basic information

  • Name display: sample1
  • Cube header: Report sample1

Cube definition ("Cube Schema XML")

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

<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>

MDX query ("Cube Query MDX")

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

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

Results

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


Sample olap.PNG

Sample olap expanded.PNG