Cube - CalculatedMembers with different colors
This tutorial discusses Calculated Members and Measures with diferent colors.
Database Schema
The Database Schema contains the Fact table with three columns: KEY and VALUE and VALUE_NUMERIC. The KEY column is used as the discriminator in the the Level and Hierarchy definitions.
<roma:DatabaseSchema id="_databaseschema">
<tables xsi:type="roma:PhysicalTable" id="_table_fact" name="Fact">
<columns xsi:type="roma:PhysicalColumn" id="_col_fact_key" name="KEY"/>
<columns xsi:type="roma:PhysicalColumn" id="_col_fact_value" name="VALUE" type="Integer"/>
</tables>
</roma:DatabaseSchema>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Query
The Query is a simple TableQuery that selects all columns from the Fact table to use in in the hierarchy and in the cube for the measures.
<roma:TableQuery id="_query" table="_table_fact"/>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Level
This Example uses one simple Level bases on the KEY column.
<roma:Level id="_level" name="theLevel" column="_col_fact_key"/>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Hierarchy without hasAll Level
The Hierarchy is defined with the hasAll property set to true and the one level.
<roma:ExplicitHierarchy id="_hierarchy" name="theHierarchy" primaryKey="_col_fact_key" query="_query" levels="_level"/>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Dimension
The dimension is defined with the one hierarchy. The hierarchy is used in the cube and in the calculated member.
<roma:StandardDimension id="_dimension" name="theDimension" hierarchies="roma:ExplicitHierarchy _hierarchy"/>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Calculated Member in Measure with different colors properties
This calculated member have BACK_COLOR in format string. It show posibility to have different colors incal culated member
<roma:CalculatedMember id="_cm1" name="Calculated Member 1" displayFolder="folder" formula="[Measures].[Measure-Sum] / [Measures].[Measure-Count]" parent="[theDimension].[theHierarchy].[All theHierarchys]" hierarchy="roma:ExplicitHierarchy _hierarchy"/>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Calculated Member in Measure with different colors properties
This calculated member have BACK_COLOR in format string. It show posibility to have different colors incal culated member
<roma:CalculatedMember id="_cm2" name="Calculated Member 2" displayFolder="folder" formula="[Measures].[Measure-Sum] / [Measures].[Measure-Count]"/>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Cube and DimensionConnector and Measure
The cube is defines by the DimensionConnector and the MeasureGroup and most importantly the calculated members.
<roma:PhysicalCube id="_cube" name="Cube CalculatedMember with different colors" query="_query">
<calculatedMembers id="_cm2" name="Calculated Member 2" displayFolder="folder" formula="[Measures].[Measure-Sum] / [Measures].[Measure-Count]">
<calculatedMemberProperties id="_format2" name="FORMAT_STRING" value="$#,##;BACK_COLOR=255;FORE_COLOR=13369395"/>
</calculatedMembers>
<calculatedMembers id="_cm1" name="Calculated Member 1" displayFolder="folder" formula="[Measures].[Measure-Sum] / [Measures].[Measure-Count]" parent="[theDimension].[theHierarchy].[All theHierarchys]" hierarchy="roma:ExplicitHierarchy _hierarchy">
<calculatedMemberProperties id="_format1" name="FORMAT_STRING" value="$#,##0.00;BACK_COLOR=65535;FORE_COLOR=13369395"/>
</calculatedMembers>
<dimensionConnectors foreignKey="roma:PhysicalColumn _col_fact_key" dimension="roma:StandardDimension _dimension"/>
<measureGroups>
<measures xsi:type="roma:SumMeasure" id="Measure-Sum" name="Measure-Sum" formatString="$#,##0.00;BACK_COLOR=32768;FORE_COLOR=0" column="_col_fact_value"/>
<measures xsi:type="roma:CountMeasure" id="Measure-Count" name="Measure-Count" formatString="$#,##0.00;BACK_COLOR=16711680;FORE_COLOR=0" column="_col_fact_value"/>
</measureGroups>
</roma:PhysicalCube>
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Definition
This files represent the complete definition of the catalog.
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:roma="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping">
<roma:ExplicitHierarchy id="_hierarchy" name="theHierarchy" primaryKey="_col_fact_key" query="_query" levels="_level"/>
<roma:Catalog name="Cube - CalculatedMembers with different colors" cubes="_cube" dbschemas="_databaseschema"/>
<roma:DatabaseSchema id="_databaseschema">
<tables xsi:type="roma:PhysicalTable" id="_table_fact" name="Fact">
<columns xsi:type="roma:PhysicalColumn" id="_col_fact_key" name="KEY"/>
<columns xsi:type="roma:PhysicalColumn" id="_col_fact_value" name="VALUE" type="Integer"/>
</tables>
</roma:DatabaseSchema>
<roma:TableQuery id="_query" table="_table_fact"/>
<roma:Level id="_level" name="theLevel" column="_col_fact_key"/>
<roma:StandardDimension id="_dimension" name="theDimension" hierarchies="_hierarchy"/>
<roma:PhysicalCube id="_cube" name="Cube CalculatedMember with different colors" query="_query">
<calculatedMembers id="_cm2" name="Calculated Member 2" displayFolder="folder" formula="[Measures].[Measure-Sum] / [Measures].[Measure-Count]">
<calculatedMemberProperties id="_format2" name="FORMAT_STRING" value="$#,##;BACK_COLOR=255;FORE_COLOR=13369395"/>
</calculatedMembers>
<calculatedMembers id="_cm1" name="Calculated Member 1" displayFolder="folder" formula="[Measures].[Measure-Sum] / [Measures].[Measure-Count]" parent="[theDimension].[theHierarchy].[All theHierarchys]" hierarchy="_hierarchy">
<calculatedMemberProperties id="_format1" name="FORMAT_STRING" value="$#,##0.00;BACK_COLOR=65535;FORE_COLOR=13369395"/>
</calculatedMembers>
<dimensionConnectors foreignKey="_col_fact_key" dimension="_dimension"/>
<measureGroups>
<measures xsi:type="roma:SumMeasure" id="Measure-Sum" name="Measure-Sum" formatString="$#,##0.00;BACK_COLOR=32768;FORE_COLOR=0" column="_col_fact_value"/>
<measures xsi:type="roma:CountMeasure" id="Measure-Count" name="Measure-Count" formatString="$#,##0.00;BACK_COLOR=16711680;FORE_COLOR=0" column="_col_fact_value"/>
</measureGroups>
</roma:PhysicalCube>
</xmi:XMI>
Turorial Zip
This files contaisn the data-tables as csv and the mapping as xmi file.