icCube可以处理远程维度,以解决流程管理的复杂建模解决方案。 Here给出了订单日期和发货日期的示例。很好的例子,几乎适用,但不完全适用。
我想显示最新阶段的变化。这些变化来自ITSM软件SAAS解决方案。简化后,更改将流经以下阶段:
每个阶段都有一个开始和结束日期。而且没有差距。
现在,我想使用范围II维度的解来显示图表中的更改(或多个更改)的生命周期。但我得到以下图表:
我如何产生所需的结果。含义,只显示某个时间间隔内变化的最新阶段?
答案 0 :(得分:1)
这两种解决方案均有效。
1)对于范围解决方案,您需要在时间维度上添加一个使用CLOSE aggregation模式的度量,因为我们希望从任何时候的最后一天开始获得“状态”期。另外,在使用范围时,两个日期都包括在内,因此结束日期应该是下一个存储桶开始前的一天。
您可以使用Sum或Eval代替Aggregate。如果在相同的查询中多次重复相同的时间段并缓存了子多维数据集,则评估速度会更快。
CREATE MEMBER [#changes ITD 2] as Eval( compactSet(NULL:[Time].[Time].currentMember) , ([Time].[Time].defaultMember,[Measures].[# changes (based on delta)]) )
2)对于“紫色青蛙”,我将compactSet用于计算所得的成员,因为没有计算所得的函数会在获取更多数据时迅速退化。每年有365天,因此,如果您有10年,则没有de compactSet时将有3650个总数。使用compactSet时,我们可以使用它,因为度量为additive,而不是10年将是9(年)+ 11(月)+31(天),这比最差的情况要少得多场景。
要使用哪个?
1)它使用更多的内存,但是由于我们使用期间值的最后一天,因此性能更快且非常稳定。添加其他时间层次结构可能会带来一些意外的结果。
CREATE MEMBER [#changes ITD] as Aggregate( compactSet(NULL:[Time].[Time].currentMember) , [Measures].[# changes (based on delta)] )
2)它使用较少的内存,我们只保存两点,但速度稍慢。
在这两个方面,我都会注意添加和使用其他时间层次结构和时间维度可能会产生一些“奇怪”的结果。
这里是更新的架构(包括[#changes ITD]定义)
<?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>
答案 1 :(得分:0)
我已经按照purple frog给出的方法找到了使用常规MDX的解决方案。不幸的是,由icCube提供的标准解决方案不支持我的问题中指出的“时间间隔间隔”问题。
我已经用封闭的icCube方案重建了该问题以供参考,也许其他人也会遇到类似的问题。在该解决方案的最后,我添加了icCube模式作为XML代码。
一些注意事项: -请注意,在“正确结果”中,2018年6月的“ 1”值已删除。这看起来可能是意外的,但符合问题的定义:显示所选时间段的结束值(在本例中为月)。由于阶段“ e”已于6月13日结束,因此在6月30日为空。
希望您也能从中受益。
这是XML构建器架构:
<?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>