蒙德里安:在针对 VirtualCube 的查询中忽略切片器轴
Mondrian: Slicer axis ignored in query against a VirtualCube
我创建了一个 VirtualCube
,在我的架构中组合了另外两个多维数据集。
但是,针对此 VirtualCube
的查询的切片器轴似乎被忽略了。
本次查询returns预期结果:
SELECT
NON EMPTY {
[Measures].[FOB],
[Measures].[CIF]
} ON 0,
NON EMPTY [Date].[Year].Members ON 1
FROM [exports_and_imports]
这个returns和上一个结果一样,错误的是:
SELECT
NON EMPTY {
[Measures].[FOB],
[Measures].[CIF]
} ON 0,
NON EMPTY [Date].[Year].members ON 1
FROM [exports_and_imports]
WHERE (
[Geography].[Washington]
)
但是,应用于 Date
维度的切片器 确实 起作用:
SELECT
NON EMPTY {
[Measures].[FOB],
[Measures].[CIF]
} ON 0
FROM [exports_and_imports]
WHERE (
[Date].[Year].&[2005]:date.year.&[2014]
)
我的架构的编辑版本:
<Schema name="datachile">
<Dimension name="Date" type="TimeDimension">...</Dimension>
<Dimension name="Geography">...</Dimension>
<Dimension name="Country">...</Dimension>
<Dimension name=“HS”>...</Dimension>
<Cube name="exports">
<DimensionUsage name="Date" source="Date" foreignKey="date_id" />
<DimensionUsage name="Destination Country" source="Country" foreignKey="country_dest_id" />
<DimensionUsage name="Export Geography" source="Geography" foreignKey="exporter_comuna_id" />
<DimensionUsage name="Export HS" source="HS" foreignKey="hs_level3" />
<Measure name="FOB US" column="fob_us" aggregator="sum" />
</Cube>
<Cube name="imports">
<DimensionUsage name="Date" source="Date" foreignKey="date_id" />
<DimensionUsage name="Origin Country" source="Country" foreignKey="country_origin_id" />
<DimensionUsage name="Import Geography" source="Geography" foreignKey="importer_comuna_id" />
<DimensionUsage name="Import HS" source="HS" foreignKey="hs_6digits" />
<Measure name="CIF US" column="cif_us" aggregator="sum" />
</Cube>
<VirtualCube name="exports_and_imports">
<CubeUsages>
<CubeUsage cubeName="exports" ignoreUnrelatedDimensions="true" />
<CubeUsage cubeName="imports" ignoreUnrelatedDimensions="true" />
</CubeUsages>
<VirtualCubeDimension name="Date" />
<VirtualCubeDimension name="Geography" />
<VirtualCubeDimension name="HS" />
<VirtualCubeMeasure cubeName="exports" name="[Measures].[FOB US]" />
<VirtualCubeMeasure cubeName="imports" name="[Measures].[CIF US]" />
<CalculatedMember name="FOB" dimension="Measures">
<Formula>ValidMeasure([Measures].[FOB US])</Formula>
</CalculatedMember>
<CalculatedMember name="CIF" dimension="Measures">
<Formula>ValidMeasure([Measures].[CIF US])</Formula>
</CalculatedMember>
</VirtualCube>
</Schema>
在您的任何多维数据集中都没有名为 "Geography" 的维度。有一个叫 "Import Geography",另一个叫 "Export Geography"。您的虚拟多维数据集正在尝试使用两个多维数据集都没有的地理维度,但是由于层次结构是使用 hasAll="true"
定义的,因此该维度默认为两个多维数据集中的 allMember。
您需要在虚拟多维数据集中定义导出和导入地理维度,并且您的切片器必须
Union( [Import Geography].[Washington] * [Export Geography].[All], [Import Geography].[All] * [Export Geography].[Washington] )
(如果您想要的是“显示华盛顿内外的总价值”)。
我创建了一个 VirtualCube
,在我的架构中组合了另外两个多维数据集。
但是,针对此 VirtualCube
的查询的切片器轴似乎被忽略了。
本次查询returns预期结果:
SELECT
NON EMPTY {
[Measures].[FOB],
[Measures].[CIF]
} ON 0,
NON EMPTY [Date].[Year].Members ON 1
FROM [exports_and_imports]
这个returns和上一个结果一样,错误的是:
SELECT
NON EMPTY {
[Measures].[FOB],
[Measures].[CIF]
} ON 0,
NON EMPTY [Date].[Year].members ON 1
FROM [exports_and_imports]
WHERE (
[Geography].[Washington]
)
但是,应用于 Date
维度的切片器 确实 起作用:
SELECT
NON EMPTY {
[Measures].[FOB],
[Measures].[CIF]
} ON 0
FROM [exports_and_imports]
WHERE (
[Date].[Year].&[2005]:date.year.&[2014]
)
我的架构的编辑版本:
<Schema name="datachile">
<Dimension name="Date" type="TimeDimension">...</Dimension>
<Dimension name="Geography">...</Dimension>
<Dimension name="Country">...</Dimension>
<Dimension name=“HS”>...</Dimension>
<Cube name="exports">
<DimensionUsage name="Date" source="Date" foreignKey="date_id" />
<DimensionUsage name="Destination Country" source="Country" foreignKey="country_dest_id" />
<DimensionUsage name="Export Geography" source="Geography" foreignKey="exporter_comuna_id" />
<DimensionUsage name="Export HS" source="HS" foreignKey="hs_level3" />
<Measure name="FOB US" column="fob_us" aggregator="sum" />
</Cube>
<Cube name="imports">
<DimensionUsage name="Date" source="Date" foreignKey="date_id" />
<DimensionUsage name="Origin Country" source="Country" foreignKey="country_origin_id" />
<DimensionUsage name="Import Geography" source="Geography" foreignKey="importer_comuna_id" />
<DimensionUsage name="Import HS" source="HS" foreignKey="hs_6digits" />
<Measure name="CIF US" column="cif_us" aggregator="sum" />
</Cube>
<VirtualCube name="exports_and_imports">
<CubeUsages>
<CubeUsage cubeName="exports" ignoreUnrelatedDimensions="true" />
<CubeUsage cubeName="imports" ignoreUnrelatedDimensions="true" />
</CubeUsages>
<VirtualCubeDimension name="Date" />
<VirtualCubeDimension name="Geography" />
<VirtualCubeDimension name="HS" />
<VirtualCubeMeasure cubeName="exports" name="[Measures].[FOB US]" />
<VirtualCubeMeasure cubeName="imports" name="[Measures].[CIF US]" />
<CalculatedMember name="FOB" dimension="Measures">
<Formula>ValidMeasure([Measures].[FOB US])</Formula>
</CalculatedMember>
<CalculatedMember name="CIF" dimension="Measures">
<Formula>ValidMeasure([Measures].[CIF US])</Formula>
</CalculatedMember>
</VirtualCube>
</Schema>
在您的任何多维数据集中都没有名为 "Geography" 的维度。有一个叫 "Import Geography",另一个叫 "Export Geography"。您的虚拟多维数据集正在尝试使用两个多维数据集都没有的地理维度,但是由于层次结构是使用 hasAll="true"
定义的,因此该维度默认为两个多维数据集中的 allMember。
您需要在虚拟多维数据集中定义导出和导入地理维度,并且您的切片器必须
Union( [Import Geography].[Washington] * [Export Geography].[All], [Import Geography].[All] * [Export Geography].[Washington] )
(如果您想要的是“显示华盛顿内外的总价值”)。