如何在icCube中的维的上层加载和处理文本数据?

时间:2018-06-20 07:50:08

标签: mdx olap iccube

我想在icCube的自然层次结构中的任何成员上加载文本数据,但是我无法使用MDX显示高层的文本值。

请考虑以下(自然)层次结构,数据和预期结果:

enter image description here (这看起来可能有些怪异,但是icCube允许将SUB013和SUB014的叶子清空。)

如上图所示,您希望在SUB015上显示“瞧”。

但是,我无法使它正常工作。查看使用MDX获得的结果: outcome in icCube MDX

我遇到以下问题:

  1. 该值为空(我在文本上使用了无聚合类型)
  2. 另一个观察结果是,对于非聚集类型,该金额也为空

这可以解决吗?

(作为片段封装-不可运行-我使用的架构,您可以在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>

1 个答案:

答案 0 :(得分:1)

在icCube中,即使是叶子,节点值也可能是多个事实行上聚合的结果。当指定NO_AGGREGATION作为聚合方法时,如果有多个单行在运行,则返回NULL。

以您为例,因为SUB015的子级值为CHILD003。尺寸由“事实汇总”定义。输入“作为成员和祖先”。

两种解决方案:

1)添加一个使用计算所得成员检索的Dimension成员属性。

2)使用带有“事实汇总”的维度。输入“”作为“会员”,但您会得到错误的费用。