how to use process management start and end dates in the ranged dimension II in icCube - mdx

icCube can process ranged dimensions to solve complex modeling solutions for process management. Here an example is given for order date and ship date. Nice example, which is almost applicable, but not entirely.
I want to display changes with their latest phase. The changes come from an ITSM software SAAS solution. Simplified, a change flows through the following stages:
to be authorized
work in progress
to be reviewed
closed
Each stage has a start- and end date. And there are no gaps.
Now I would like to show the life-cycle of a change (or multiple changes) in a chart using the solution of the ranged II dimension. But I get the following chart:
How can I produce the required outcome. Meaning, only show the latest stage of a change during a certain time interval?

Both solutions work.
1) For the range solution, you need to add a measure that uses CLOSE aggregation mode on the Time Dimension as we want the 'state' as of the last day of any time period. Also, both dates are included when using range, so end date should be one day before the start of the next bucket.
You can use Sum or Eval instead of Aggregate. Eval will be faster if the same time period is reused multiple times in the same query as the subcube is cached.
CREATE MEMBER [#changes ITD 2] as Eval( compactSet(NULL:[Time].[Time].currentMember) , ([Time].[Time].defaultMember,[Measures].[# changes (based on delta)]) )
2) For Purple Frog one, I'd use compactSet for the calculated member as without the calculated function will quickly degradated when getting more an more data. It's 365 days for each year, so if you've 10 years you'll have 3650 sums without de compactSet. With the compactSet, we can use it as the measure is additive, instead of 10 years will have something like, 9 (years) + 11 (months) + 31(days) , that is a lot less on the worst scenario.
Which one to use ?
1) It uses more memory but the performance is faster and amazingly stable as we're using the last day of the period value. Adding other time hierarchies might give some unexpected results.
CREATE MEMBER [#changes ITD] as Aggregate( compactSet(NULL:[Time].[Time].currentMember) , [Measures].[# changes (based on delta)] )
2) It uses less memory, we only save two points, but it a bit slower.
On both I'd pay attention that adding, and using, other Time hierarchies and Time dimensions might give some 'strange' results.
Here the updated schema ( [#changes ITD] definition is included)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<schemaFactory revisionNumber="11">
<schemaDefinition name="Phases - ranged dimension II" description="issue description StackOverflow" group="StackOverflow" loadOnStartup="false">
<activateIncrementalLoad>false</activateIncrementalLoad>
<useUnknownMembersInFacts>false</useUnknownMembersInFacts>
<autoCleanUpTableColumns>false</autoCleanUpTableColumns>
<useFactPartitioning>false</useFactPartitioning>
<callGarbageCollector>NONE</callGarbageCollector>
<backup>NONE</backup>
<nonEmptyCachePolicy>NONE</nonEmptyCachePolicy>
<nonEmptyCacheType>REGULAR</nonEmptyCacheType>
<nonEmptyCachePersistency>MEMORY</nonEmptyCachePersistency>
<storagePolicy>DEFAULT</storagePolicy>
<hierarchyUniqueNameStyle>IncludeDimensionName</hierarchyUniqueNameStyle>
<inMemoryDS name="manual">
<memoryDataTable tableName="facts" rowLimit="-1" id="c41cc2b5-1412-4da1-8e0e-3bd1b07e9d66">
<column name="start" tableType="STRING" type="DATE" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="end" tableType="STRING" type="DATE" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="phase" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="chg" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="#changes" tableType="STRING" type="INTEGER" selected="true" primaryKey="false" nullObjectAsString=""/>
<addRowNumber>false</addRowNumber>
<stringDateConverter>d MMM, yyyy</stringDateConverter>
<stringDateConverterLocale>en</stringDateConverterLocale>
<trimStrings>true</trimStrings>
<columnSeparator>;</columnSeparator>
<commentMarker>#</commentMarker>
<dataAsString>start;end;phase;chg;#changes
1 January, 2018;31 January, 2018; a;chg001;1
1 February, 2018;4 March, 2018;b;chg001;1
5 March, 2018;19 March, 2018;c;chg001;1
20 March, 2018;19 March, 2018;d;chg001;1
20 March, 2018;2 June, 2018;e;chg001;1
</dataAsString>
</memoryDataTable>
<memoryDataTable tableName="phases" rowLimit="-1" id="b24aaebb-7ce3-42a9-bab0-a54bc4c4b896">
<column name="phase" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<addRowNumber>false</addRowNumber>
<stringDateConverter></stringDateConverter>
<trimStrings>true</trimStrings>
<columnSeparator>,</columnSeparator>
<commentMarker>#</commentMarker>
<dataAsString>phase
a
b
c
d
e
</dataAsString>
</memoryDataTable>
<memoryDataTable tableName="changes" rowLimit="-1" id="8ba9aaca-0d93-49b1-851f-4f325e05bbbe">
<column name="chg" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<addRowNumber>false</addRowNumber>
<stringDateConverter></stringDateConverter>
<trimStrings>true</trimStrings>
<columnSeparator>;</columnSeparator>
<commentMarker>#</commentMarker>
<dataAsString>chg
chg001
chg002
chg003</dataAsString>
</memoryDataTable>
<memoryDataTable tableName="facts - delta" rowLimit="-1" id="aea29582-84e2-4ef4-a169-5d9549141ba6">
<column name="date" tableType="STRING" type="DATE" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="phase" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="chg" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="delta" tableType="STRING" type="INTEGER" selected="true" primaryKey="false" nullObjectAsString=""/>
<addRowNumber>false</addRowNumber>
<stringDateConverter>d MMM, yyyy</stringDateConverter>
<stringDateConverterLocale>en</stringDateConverterLocale>
<trimStrings>true</trimStrings>
<columnSeparator>;</columnSeparator>
<commentMarker>#</commentMarker>
<dataAsString>date;phase;chg;delta
1 January, 2018;a;chg001;1
1 February, 2018;b;chg001;1
5 March, 2018;c;chg001;1
20 March, 2018;d;chg001;1
20 March, 2018;e;chg001;1
1 February, 2018;a;chg001; -1
5 March, 2018;b;chg001;-1
20 March, 2018;c;chg001;-1
20 March, 2018;d;chg001;-1
13 June, 2018;e;chg001;-1
</dataAsString>
</memoryDataTable>
</inMemoryDS>
<multiLevelDimension dataTableId="8ba9aaca-0d93-49b1-851f-4f325e05bbbe" isTimeDimension="false" isDefaultTimeDimension="false" isIndexingByRange="false" id="0c4cf980-73d9-4c42-ae47-a300421c29a2" name="Change">
<multiLevelHierarchy hasAllLevel="true" allLevelName="All-Level" allMemberName="All" name="Change" isDefault="true">
<level name="change" nameUnique="false" nameUniqueInParent="false" keyUnique="false" ignoreNameCollision="false">
<nameCol name="chg"/>
<orderType>BY_NAME</orderType>
<orderKind>ASC</orderKind>
</level>
</multiLevelHierarchy>
</multiLevelDimension>
<multiLevelDimension dataTableId="b24aaebb-7ce3-42a9-bab0-a54bc4c4b896" isTimeDimension="false" isDefaultTimeDimension="false" isIndexingByRange="false" id="ed48052e-2c11-48a8-9407-c4854b163cb6" name="Phase">
<multiLevelHierarchy hasAllLevel="true" allLevelName="All-Level" allMemberName="All" name="Phase" isDefault="true">
<level name="phase" nameUnique="false" nameUniqueInParent="false" keyUnique="false" ignoreNameCollision="false">
<nameCol name="phase"/>
<orderType>BY_NAME</orderType>
<orderKind>ASC</orderKind>
</level>
</multiLevelHierarchy>
</multiLevelDimension>
<timeWizardDimension isDefaultTimeDimension="false" isIndexingByRange="true" from="2018-06-01T00:00:00.000" to="2018-07-31T00:00:00.000" dataTableId="c41cc2b5-1412-4da1-8e0e-3bd1b07e9d66" unknownMemberName="" id="b545bf65-ec47-4267-a4f1-a8df35096bc4" name="Time">
<timeHierarchy hasAllLevel="true" allLevelName="All-L" allMemberName="All-M" name="Time" isDefault="true" defaultMemberName="">
<factAggregationType>MEMBER_AND_ANCESTORS</factAggregationType>
<level name="Year" type="YEAR">
<useRelativeKey>false</useRelativeKey>
</level>
<level name="Month" type="MONTH" nameFormat="">
<useRelativeKey>false</useRelativeKey>
</level>
<level name="Day" type="DAY" nameFormat="">
<useRelativeKey>false</useRelativeKey>
</level>
</timeHierarchy>
<timeWizardColumn name="start"/>
</timeWizardDimension>
<cube id="b9aceb66-c3dc-4d20-9f74-1ada8769cf75" name="Changes" description="">
<defaultFacts measureGroupName="Facts" partitioningLevelName="" partitioningType="NONE" newGeneration="true" dataTableId="c41cc2b5-1412-4da1-8e0e-3bd1b07e9d66" aggregateDataSourceFacts="false" unresolvedRowsBehavior="ERROR">
<rowFactAggregationType>ADD_ROW</rowFactAggregationType>
<measure name="# changes" aggregationType="SUM">
<rollupHierarchy></rollupHierarchy>
<dataColumn name="#changes"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<measure name="# changes close" aggregationType="CLOSE">
<rollupHierarchy>[Time].[Time]</rollupHierarchy>
<dataColumn name="#changes"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<links dimensionId="0c4cf980-73d9-4c42-ae47-a300421c29a2">
<viewLinks type="LAST_LEVEL">
<toColumns name="chg"/>
</viewLinks>
</links>
<links dimensionId="ed48052e-2c11-48a8-9407-c4854b163cb6">
<viewLinks type="LAST_LEVEL">
<toColumns name="phase"/>
</viewLinks>
</links>
<links dimensionId="b545bf65-ec47-4267-a4f1-a8df35096bc4">
<viewLinks type="RANGE_FROM_TO">
<toColumns name="start"/>
<toColumns name="end"/>
</viewLinks>
</links>
</defaultFacts>
<defaultFacts measureGroupName="Facts - delta" partitioningLevelName="" partitioningType="NONE" newGeneration="true" dataTableId="aea29582-84e2-4ef4-a169-5d9549141ba6" aggregateDataSourceFacts="false" unresolvedRowsBehavior="ERROR">
<rowFactAggregationType>ADD_ROW</rowFactAggregationType>
<measure name="# changes (based on delta)" aggregationType="SUM">
<rollupHierarchy></rollupHierarchy>
<dataColumn name="delta"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<links dimensionId="0c4cf980-73d9-4c42-ae47-a300421c29a2">
<viewLinks type="LAST_LEVEL">
<toColumns name="chg"/>
</viewLinks>
</links>
<links dimensionId="ed48052e-2c11-48a8-9407-c4854b163cb6">
<viewLinks type="LAST_LEVEL">
<toColumns name="phase"/>
</viewLinks>
</links>
<links dimensionId="b545bf65-ec47-4267-a4f1-a8df35096bc4">
<viewLinks type="LAST_LEVEL">
<toColumns name="date"/>
</viewLinks>
</links>
</defaultFacts>
</cube>
<localization enabled="false"/>
<script>
<content>--
-- Automatically migrated from an old XML file definition format (v2.0.4 or before)
--
--
-- Drop all calc. members, sets and functions declared at schema/cube levels
--
DROP *
--
-- Functions
--
--
-- Sets
--
--
-- Calculated Measures/Members
--
CREATE MEMBER [#changes ITD] as Aggregate( compactSet(NULL:[Time].[Time].currentMember) , [Measures].[# changes (based on delta)] )</content>
</script>
</schemaDefinition>
</schemaFactory>

I have found a solution with regular MDX following the approach given by purple frog. Unfortunately the standard solution provided by icCube does not support the "end-of-period-interval" problem as indicated in my question.
I have rebuild the problem in enclosed icCube scheme for reference, might someone else run into a similar problem. At the end of this solution I have added the icCube schema as XML code.
1st - the data
(LEFT: data set for Ranged Dimension II - but does not work for phases, RIGHT: data set that provides the required result)
INCORRECT RESULT - the MDX based on LEFT - ranged dimension:
CORRECT RESULT - the MDX based on the RIGHT data set:
A few considerations:
- Notice that in the "CORRECT RESULT" the "1" value for 2018 Jun has been removed. This might seem unexpected but it is in line with the definition of the problem: show the value of the end of the selected period (in this case: month). And as it has phase "e" has been ended 13 June, it is empty at 30 June.
Hope you benefit from this too.
Here is the XML builder schema:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<schemaFactory revisionNumber="7">
<schemaDefinition name="Phases - ranged dimension II" description="issue description StackOverflow" group="StackOverflow" loadOnStartup="false">
<activateIncrementalLoad>false</activateIncrementalLoad>
<useUnknownMembersInFacts>false</useUnknownMembersInFacts>
<autoCleanUpTableColumns>false</autoCleanUpTableColumns>
<useFactPartitioning>false</useFactPartitioning>
<callGarbageCollector>NONE</callGarbageCollector>
<backup>NONE</backup>
<nonEmptyCachePolicy>NONE</nonEmptyCachePolicy>
<nonEmptyCacheType>REGULAR</nonEmptyCacheType>
<nonEmptyCachePersistency>MEMORY</nonEmptyCachePersistency>
<storagePolicy>DEFAULT</storagePolicy>
<hierarchyUniqueNameStyle>IncludeDimensionName</hierarchyUniqueNameStyle>
<inMemoryDS name="manual">
<memoryDataTable tableName="facts" rowLimit="-1" id="c41cc2b5-1412-4da1-8e0e-3bd1b07e9d66">
<column name="start" tableType="STRING" type="DATE" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="end" tableType="STRING" type="DATE" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="phase" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="chg" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="#changes" tableType="STRING" type="INTEGER" selected="true" primaryKey="false" nullObjectAsString=""/>
<addRowNumber>false</addRowNumber>
<stringDateConverter>d MMM, yyyy</stringDateConverter>
<stringDateConverterLocale>en</stringDateConverterLocale>
<trimStrings>true</trimStrings>
<columnSeparator>;</columnSeparator>
<commentMarker>#</commentMarker>
<dataAsString>start;end;phase;chg;#changes
1 January, 2018;1 February, 2018; a;chg001;1
1 February, 2018;5 March, 2018;b;chg001;1
5 March, 2018;20 March, 2018;c;chg001;1
20 March, 2018;20 March, 2018;d;chg001;1
20 March, 2018;3 June, 2018;e;chg001;1
</dataAsString>
</memoryDataTable>
<memoryDataTable tableName="phases" rowLimit="-1" id="b24aaebb-7ce3-42a9-bab0-a54bc4c4b896">
<column name="phase" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<addRowNumber>false</addRowNumber>
<stringDateConverter></stringDateConverter>
<trimStrings>true</trimStrings>
<columnSeparator>,</columnSeparator>
<commentMarker>#</commentMarker>
<dataAsString>phase
a
b
c
d
e
</dataAsString>
</memoryDataTable>
<memoryDataTable tableName="changes" rowLimit="-1" id="8ba9aaca-0d93-49b1-851f-4f325e05bbbe">
<column name="chg" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<addRowNumber>false</addRowNumber>
<stringDateConverter></stringDateConverter>
<trimStrings>true</trimStrings>
<columnSeparator>;</columnSeparator>
<commentMarker>#</commentMarker>
<dataAsString>chg
chg001
chg002
chg003</dataAsString>
</memoryDataTable>
<memoryDataTable tableName="facts - delta" rowLimit="-1" id="aea29582-84e2-4ef4-a169-5d9549141ba6">
<column name="date" tableType="STRING" type="DATE" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="phase" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="chg" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="delta" tableType="STRING" type="INTEGER" selected="true" primaryKey="false" nullObjectAsString=""/>
<addRowNumber>false</addRowNumber>
<stringDateConverter>d MMM, yyyy</stringDateConverter>
<stringDateConverterLocale>en</stringDateConverterLocale>
<trimStrings>true</trimStrings>
<columnSeparator>;</columnSeparator>
<commentMarker>#</commentMarker>
<dataAsString>date;phase;chg;delta
1 January, 2018;a;chg001;1
1 February, 2018;b;chg001;1
5 March, 2018;c;chg001;1
20 March, 2018;d;chg001;1
20 March, 2018;e;chg001;1
1 February, 2018;a;chg001; -1
5 March, 2018;b;chg001;-1
20 March, 2018;c;chg001;-1
20 March, 2018;d;chg001;-1
13 June, 2018;e;chg001;-1
</dataAsString>
</memoryDataTable>
</inMemoryDS>
<multiLevelDimension dataTableId="8ba9aaca-0d93-49b1-851f-4f325e05bbbe" isTimeDimension="false" isDefaultTimeDimension="false" isIndexingByRange="false" id="0c4cf980-73d9-4c42-ae47-a300421c29a2" name="Change">
<multiLevelHierarchy hasAllLevel="true" allLevelName="All-Level" allMemberName="All" name="Change" isDefault="true">
<level name="change" nameUnique="false" nameUniqueInParent="false" keyUnique="false" ignoreNameCollision="false">
<nameCol name="chg"/>
<orderType>BY_NAME</orderType>
<orderKind>ASC</orderKind>
</level>
</multiLevelHierarchy>
</multiLevelDimension>
<multiLevelDimension dataTableId="b24aaebb-7ce3-42a9-bab0-a54bc4c4b896" isTimeDimension="false" isDefaultTimeDimension="false" isIndexingByRange="false" id="ed48052e-2c11-48a8-9407-c4854b163cb6" name="Phase">
<multiLevelHierarchy hasAllLevel="true" allLevelName="All-Level" allMemberName="All" name="Phase" isDefault="true">
<level name="phase" nameUnique="false" nameUniqueInParent="false" keyUnique="false" ignoreNameCollision="false">
<nameCol name="phase"/>
<orderType>BY_NAME</orderType>
<orderKind>ASC</orderKind>
</level>
</multiLevelHierarchy>
</multiLevelDimension>
<timeWizardDimension isDefaultTimeDimension="false" isIndexingByRange="true" from="2018-06-01T00:00:00.000" to="2018-07-31T00:00:00.000" dataTableId="c41cc2b5-1412-4da1-8e0e-3bd1b07e9d66" unknownMemberName="" id="b545bf65-ec47-4267-a4f1-a8df35096bc4" name="Time">
<timeHierarchy hasAllLevel="true" allLevelName="All-L" allMemberName="All-M" name="Time" isDefault="true" defaultMemberName="">
<factAggregationType>MEMBER_AND_ANCESTORS</factAggregationType>
<level name="Year" type="YEAR">
<useRelativeKey>false</useRelativeKey>
</level>
<level name="Month" type="MONTH" nameFormat="">
<useRelativeKey>false</useRelativeKey>
</level>
<level name="Day" type="DAY" nameFormat="">
<useRelativeKey>false</useRelativeKey>
</level>
</timeHierarchy>
<timeWizardColumn name="start"/>
</timeWizardDimension>
<cube id="b9aceb66-c3dc-4d20-9f74-1ada8769cf75" name="Changes" description="">
<defaultFacts measureGroupName="Facts" partitioningLevelName="" partitioningType="NONE" newGeneration="true" dataTableId="c41cc2b5-1412-4da1-8e0e-3bd1b07e9d66" aggregateDataSourceFacts="false" unresolvedRowsBehavior="ERROR">
<rowFactAggregationType>ADD_ROW</rowFactAggregationType>
<measure name="# changes" aggregationType="SUM">
<rollupHierarchy></rollupHierarchy>
<dataColumn name="#changes"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<measure name="# changes close" aggregationType="CLOSE">
<rollupHierarchy>[Phase].[Phase]</rollupHierarchy>
<dataColumn name="#changes"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<links dimensionId="0c4cf980-73d9-4c42-ae47-a300421c29a2">
<viewLinks type="LAST_LEVEL">
<toColumns name="chg"/>
</viewLinks>
</links>
<links dimensionId="ed48052e-2c11-48a8-9407-c4854b163cb6">
<viewLinks type="LAST_LEVEL">
<toColumns name="phase"/>
</viewLinks>
</links>
<links dimensionId="b545bf65-ec47-4267-a4f1-a8df35096bc4">
<viewLinks type="RANGE_FROM_TO">
<toColumns name="start"/>
<toColumns name="end"/>
</viewLinks>
</links>
</defaultFacts>
<defaultFacts measureGroupName="Facts - delta" partitioningLevelName="" partitioningType="NONE" newGeneration="true" dataTableId="aea29582-84e2-4ef4-a169-5d9549141ba6" aggregateDataSourceFacts="false" unresolvedRowsBehavior="ERROR">
<rowFactAggregationType>ADD_ROW</rowFactAggregationType>
<measure name="# changes (based on delta)" aggregationType="SUM">
<rollupHierarchy></rollupHierarchy>
<dataColumn name="delta"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<links dimensionId="0c4cf980-73d9-4c42-ae47-a300421c29a2">
<viewLinks type="LAST_LEVEL">
<toColumns name="chg"/>
</viewLinks>
</links>
<links dimensionId="ed48052e-2c11-48a8-9407-c4854b163cb6">
<viewLinks type="LAST_LEVEL">
<toColumns name="phase"/>
</viewLinks>
</links>
<links dimensionId="b545bf65-ec47-4267-a4f1-a8df35096bc4">
<viewLinks type="LAST_LEVEL">
<toColumns name="date"/>
</viewLinks>
</links>
</defaultFacts>
</cube>
<localization enabled="false"/>
<script>
<content>--
-- Automatically migrated from an old XML file definition format (v2.0.4 or before)
--
--
-- Drop all calc. members, sets and functions declared at schema/cube levels
--
DROP *
--
-- Functions
--
--
-- Sets
--
--
-- Calculated Measures/Members
--
</content>
</script>
</schemaDefinition>
</schemaFactory>

Related

How to load and process text data on upper-levels of a dimension in icCube?

I want to load textual data on any member in a natural hierarchy in icCube, but I am not able to display the textual values with MDX for the upper-levels.
Consider the following (natural) hierarchy, data and expected outcome:
(It might look a bit weird, but icCube allows to have the leaf empty for SUB013 and SUB014.)
As you can see in the desired outcome in the picture above, I expect "voila" to be displayed on SUB015.
But, I can not get it to work. See the outcome I get with MDX:
I have the following issues:
the value is empty (I have used the no aggregation type on text)
another observation is that also the amount is empty for a no aggregation type
Is this solvable, somehow?
(enclosed as a snippet - not runnable - the schema I used, which you can upload in your instance of icCube)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<schemaFactory revisionNumber="77">
<schemaDefinition name="text on sub-total" description="" group="Research" loadOnStartup="false">
<activateIncrementalLoad>false</activateIncrementalLoad>
<useUnknownMembersInFacts>false</useUnknownMembersInFacts>
<autoCleanUpTableColumns>false</autoCleanUpTableColumns>
<useFactPartitioning>false</useFactPartitioning>
<callGarbageCollector>NONE</callGarbageCollector>
<backup>NONE</backup>
<nonEmptyCachePolicy>NONE</nonEmptyCachePolicy>
<nonEmptyCacheType>REGULAR</nonEmptyCacheType>
<nonEmptyCachePersistency>MEMORY</nonEmptyCachePersistency>
<storagePolicy>DEFAULT</storagePolicy>
<hierarchyUniqueNameStyle>IncludeDimensionName</hierarchyUniqueNameStyle>
<inMemoryDS name="manual">
<memoryDataTable tableName="data" rowLimit="-1" id="3c476e37-708d-4066-831c-89508134beb7">
<column name="dim" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="costs" tableType="STRING" type="DOUBLE" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="text" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<addRowNumber>false</addRowNumber>
<stringDateConverter></stringDateConverter>
<trimStrings>true</trimStrings>
<columnSeparator>\t</columnSeparator>
<commentMarker>#</commentMarker>
<dataAsString>dim costs text
CHILD001
CHILD002
CHILD003 10 hi
CHILD004
CHILD005
SUB013 59 salut
SUB014 69 bonjour
SUB015 180 voila
</dataAsString>
</memoryDataTable>
<memoryDataTable tableName="dim" rowLimit="-1" id="373a4b14-5b7d-441d-91c0-caabeb670936">
<column name="SubTotal" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="Leaf" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<addRowNumber>false</addRowNumber>
<stringDateConverter></stringDateConverter>
<trimStrings>true</trimStrings>
<columnSeparator>\t</columnSeparator>
<commentMarker>#</commentMarker>
<dataAsString>SubTotal Leaf
SUB013
SUB014
SUB015 CHILD001
SUB015 CHILD002
SUB015 CHILD003
SUB015 CHILD004
SUB015 CHILD005
</dataAsString>
</memoryDataTable>
</inMemoryDS>
<multiLevelDimension dataTableId="373a4b14-5b7d-441d-91c0-caabeb670936" isTimeDimension="false" isDefaultTimeDimension="false" isIndexingByRange="false" unknownMemberName="" id="6b08783b-b33c-4499-b253-212753be23fd" name="Dim">
<multiLevelHierarchy hasAllLevel="true" allLevelName="All-L" allMemberName="All-M" name="Dim" isDefault="true" defaultMemberName="">
<factAggregationType>MEMBER_AND_ANCESTORS</factAggregationType>
<level name="subtotal" nameUnique="true" nameUniqueInParent="false" keyUnique="true" ignoreNameCollision="false">
<column name="SubTotal"/>
<nameCol name="SubTotal"/>
<orderType>NONE</orderType>
<orderKind>ASC</orderKind>
</level>
<level name="leaf" nameUnique="true" nameUniqueInParent="false" keyUnique="true" ignoreNameCollision="false">
<column name="Leaf"/>
<nameCol name="Leaf"/>
<orderType>NONE</orderType>
<orderKind>ASC</orderKind>
</level>
</multiLevelHierarchy>
</multiLevelDimension>
<cube id="1c361ef2-ebba-475f-9cc8-83910e4530e2" name="data" description="">
<defaultFacts measureGroupName="Facts" partitioningLevelName="" partitioningType="NONE" newGeneration="true" dataTableId="3c476e37-708d-4066-831c-89508134beb7" aggregateDataSourceFacts="false" unresolvedRowsBehavior="ERROR">
<rowFactAggregationType>ADD_ROW</rowFactAggregationType>
<measure name="costs sum" aggregationType="SUM">
<rollupHierarchy></rollupHierarchy>
<dataColumn name="costs"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<measure name="costs max" aggregationType="MAX">
<rollupHierarchy></rollupHierarchy>
<dataColumn name="costs"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<measure name="costs no agg" aggregationType="NONE">
<rollupHierarchy></rollupHierarchy>
<dataColumn name="costs"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<measure name="text max" aggregationType="MAX">
<rollupHierarchy></rollupHierarchy>
<dataColumn name="text"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<measure name="text no agg" aggregationType="NONE">
<rollupHierarchy></rollupHierarchy>
<dataColumn name="text"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<links dimensionId="6b08783b-b33c-4499-b253-212753be23fd">
<viewLinks type="ALL_LEVELS">
<toColumns name="dim"/>
</viewLinks>
</links>
</defaultFacts>
</cube>
<localization enabled="false"/>
<script>
<content>
</content>
</script>
</schemaDefinition>
</schemaFactory>
In icCube a node value, even if leaf, can be the result of an aggregation over multiple facts rows. When you specify, NO_AGGREGATION, as aggregation method the NULL is returned if more than one single row is in play.
For you example as SUB015 has a child with value, CHILD003. And the dimension is defined with 'Fact Aggr. Type' as 'Members and Ancestors'.
Two solutions :
1) Add a Dimension member property that is retrieved using a calculated member.
2) Use a dimension with 'Fact Aggr. Type' as 'Members' but you will get wrong cost.

How to Visualize properties with Mdx

I m new to the mdx query.
I have spatial properties that i want to visualize in a geomondrian table, this is the schema of simple_geofoodmart.xml :
<!-- spatial store dimension -->
<Dimension name="Store" foreignKey="store_id">
<Hierarchy hasAll="true" primaryKey="store_id" primaryKeyTable="geostore_store">
<Join leftKey="store_city_id_fk" rightKey="store_city_id"
rightAlias="geostore_city">
<Table name="geostore_store" />
<Join leftKey="store_state_id_fk" rightKey="store_state_id"
rightAlias="geostore_state">
<Table name="geostore_city" />
<Join leftKey="store_country_id_fk" rightKey="store_country_id">
<Table name="geostore_state" />
<Table name="geostore_country" />
</Join>
</Join>
</Join>
<Level name="Store Country" table="geostore_country" column="store_country_name"
uniqueMembers="true">
<Property name="geom" column="store_country_geom" type="Geometry" />
</Level>
<Level name="Store State" table="geostore_state" column="store_state_name"
uniqueMembers="true">
<Property name="geom" column="store_state_geom" type="Geometry" />
</Level>
<Level name="Store City" table="geostore_city" column="store_city_name"
uniqueMembers="false">
<Property name="geom" column="store_city_geom" type="Geometry" />
</Level>
<Level name="Store Name" table="geostore_store" column="store_name"
uniqueMembers="true">
<Property name="Store Type" column="store_type"/>
<Property name="Store Manager" column="store_manager"/>
<Property name="Store Sqft" column="store_sqft" type="Numeric"/>
<Property name="Street address" column="store_street_address" type="String"/>
</Level>
</Hierarchy>
</Dimension>
I want to get the "geom" proporty in columns and the products in rows
Usually you do it like that:
SELECT
[Measure] ON COLUMNS,
NON EMPTY [Store].MEMBERS
DIMENSION PROPERTIES
[Store].[geom] ON ROWS
FROM [Cube]
You list the DIMENSION PROPERTIES in the dimension axis
Actually i found a solution by tricking the mdx examples given in the Basic interface for ad hoc GeoMDX queries in localhost index
with member Measures.geo as [Store].CurrentMember.Properties("geom")
select {[Measures].geo} ON rows,
{[Store].[All Stores].[USA]} ON columns
from [Sales]

Multiple hierarchy in mondrian says Hierarchy not found

I have following Dimension in mondrian schema. Mondrian on creating connection says
mondrian.olap.MondrianException: Mondrian Error:Internal error: Hierarchy '[Product]' not found
<Dimension name="Product" foreignKey="item_id">
<Hierarchy hasAll="true" primaryKey="item_code" primaryKeyTable="m_item_master">
<Join leftKey="item_code" rightKey="item_code">
<Table name="m_item_master"/> <!--dummy_master--> <!--m_item_master-->
<Table name="m_item_relation"/>
</Join>
<Level name="Department" table="m_item_relation" column="department"/>
<Level name="Class" table="m_item_relation" column="category"/>
<Level name="Item" table="m_item_master" column="item_code" ordinalColumn="item_code" nameColumn="name" uniqueMembers="true" type="Numeric"/>
</Hierarchy>
<Hierarchy name="Base Item" hasAll="false" primaryKey="item_code" primaryKeyTable="m_item_master">
<Join leftKey="item_code" rightKey="item_code">
<Table name="m_item_master"/> <!--dummy_master--> <!--m_item_master-->
<Table name="m_item_relation"/>
</Join>
<Level name="Department" table="m_item_relation" column="department" captionColumn="department"/>
<Level name="Item" table="m_item_master" column="item_code" ordinalColumn="item_code" nameColumn="name" uniqueMembers="true" captionColumn="name" type="Numeric"/>
<Property name="Price" table="m_item_master" column="price" />
</Hierarchy>
</Dimension>
I am using Mondrian-4.0.0-SNAPSHOT version and tried the same with latest mondrian 4.2.0.0-204 version as well.
Note:
Moreover I am getting this Error during mondrian connection creation itself. So it doesn't concern with any MDX query passed to it.
Ok. This is the what the mistake I found. For the clarification, Mondrian do support multiple hierarchy, but to the above schema we seems to have a different problem with the associated roles.
<Role name="myrole">
<SchemaGrant access="none">
<CubeGrant cube="Transaction" access="all">
<HierarchyGrant hierarchy="[Product]" access="custom" rollupPolicy="partial">
<MemberGrant member="[Product].[Cottage Foods]" access="all"/>
<MemberGrant member="[Product].[Vegetables]" access="all"/>
....
</HierarchyGrant>
....
</CubeGrant>
</SchemaGrant>
</Role>
In the above role, though the default hierarchy takes the name of the dimension in mondrian, we have to specify them as [Dimension.Hierarchy] in roles but not just Hierarchy name if you have multiple hierarchy within the Dimension. In our case, it should be as below.
<Role name="myrole">
<SchemaGrant access="none">
<CubeGrant cube="Transaction" access="all">
<HierarchyGrant hierarchy="[Product.Product]" access="custom" rollupPolicy="partial">
<MemberGrant member="[Product.Product].[Cottage Foods]" access="all"/>
<MemberGrant member="[Product.Product].[Vegetables]" access="all"/>
....
</HierarchyGrant>
....
</CubeGrant>
</SchemaGrant>
</Role>
This solves the above problem.

Pentaho MDX roles

I try to create some restriction in pentaho jpivot
1. i have 2 users (user1 - role1 and user2 - role2)
2. i have a pivot with this values
store | owner | sales
---------------------
s1 | user1 | 1235
| user2 | 2684
s2 | user1 | 1628
| user2 | 1002
s3 | user1 | 1111
| user2 | 1596
...
my schema look like this one:
<Schema name="asimov1">
<Dimension type="StandardDimension" visible="true" foreignKey="owner" name="owner">
<Hierarchy name="owner" visible="true" hasAll="false" primaryKey="owner" primaryKeyTable="storeTable">
<Level name="owner" visible="true" table="storeTable" column="owner" uniqueMembers="false">
</Level>
</Hierarchy>
</Dimension>
<Dimension type="StandardDimension" visible="true" foreignKey="store1" name="store1">
<Hierarchy name="store1" visible="true" hasAll="true" primaryKey="store1" primaryKeyTable="storeTable">
<Level name="store1" visible="true" table="storeTable" column="store1" uniqueMembers="false">
</Level>
</Hierarchy>
</Dimension>
<Cube name="asimov1" caption="asimov1" visible="true" description="asimov1" cache="true" enabled="true">
<Table name="storeTable">
</Table>
<DimensionUsage source="store1" name="store1" visible="true" foreignKey="store1">
</DimensionUsage>
<DimensionUsage source="owner" name="owner" visible="true" foreignKey="owner">
</DimensionUsage>
<Measure name="sales" column="sales" formatString="#" aggregator="sum">
</Measure>
</Cube>
</Schema>
my select:
select NON EMPTY Crossjoin({[owner].[owner].Members}, {[Measures].[sales]}) ON COLUMNS,
NON EMPTY {[store].[store].Members} ON ROWS
from [role_test]
I want when i login as user1 to see just user1 values and so for user2.
I made this using xaction who add a where clause, but user1 stil can see values of user2 if access the jpivot OLAP navigator.
I added visible="false" to dimension owner, but no effect.
I made roles with no effect.
<Role name="user1">
<SchemaGrant access="none">
<CubeGrant cube="asimov1" access="all">
<HierarchyGrant hierarchy="owner" topLevel="owner" bottomLevel="owner" access="custom">
<MemberGrant member="[owner].[user1]" access="all">
</MemberGrant>
<MemberGrant member="[owner].[user2]" access="none">
</MemberGrant>
</HierarchyGrant>
</CubeGrant>
</SchemaGrant>
....
That's all, so please gime some guidance.
Best regards,
dga
All was good, except this:
Before use roles must uncomment this line in biserver-ce/pentaho-solutions/system/pentahoObjects.spring.xml
<bean id="Mondrian-UserRoleMapper"
name="Mondrian-One-To-One-UserRoleMapper"
class="org.pentaho.platform.plugin.action.mondrian.mapper.MondrianOneToOneUserRoleListMapper"
scope="singleton" />

Using the Propel ORM, how would one delete all related records of an object?

I have a pretty simple Propel question. I'm storing leads in a database. Those leads have one or more community interests. The tables I'm using are named, 'lead', 'community', and a 'lead_communities' join table. What's the best way to delete all of a lead's community interests?
Here are some more details. The Propel schema looks like this:
<table name="community">
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true" />
<column name="name" type="VARCHAR" size="255" />
<column name="address" type="VARCHAR" size="255" />
etc...
<table name="lead_communities">
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true"/>
<column name="lead_id" type="INTEGER" />
<column name="community_id" type="INTEGER" />
<column name="created_date" type="DATE" size="4" />
<foreign-key foreignTable="community" refPhpName="Lead_Communities">
<reference local="community_id" foreign="id"/>
</foreign-key>
<foreign-key foreignTable="lead" refPhpName="Lead_Communities">
<reference local="lead_id" foreign="id"/>
</foreign-key>
</table>
<table name="lead">
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true"/>
<column name="salutation" type="VARCHAR" size="20" />
<column name="first_name" type="VARCHAR" size="255" defaultValue="" />
<column name="last_name" type="VARCHAR" size="255" defaultValue="" />
<column name="email" type="VARCHAR" size="255" defaultValue="" />
etc..
Here's how I select the lead from the database:
$lead = LeadQuery::create()->filterByEmail($enauk)->findOne();
So, what I hope to do is something like:
$lead->deleteLeadCommunities();
Well, the easiest way I can think of without any other context is simply doing a query on the join table with a delete() call:
$numDeleted = LeadCommunitiesQuery::create()
->filterByLead($lead)
->delete();
Just to be clear, there is no generated method like what you want (deleteLeadCommunities), but you could always write it for convenience, and replace $lead in my example code with $this. So inside Lead.php:
public function deleteLeadCommunities() {
return LeadCommunitiesQuery::create()
->filterByLead($this)
->delete();
}