我有这样的数据集MDX查询:
SELECT NON EMPTY {
[Measures].[InventarioDirectoInventario_Inventario],
[Measures].[InventarioDirectoInventario_InventarioAcumulado],
[Measures].[InventarioDirectoVentas_VentaAcumulada],
[Measures].[InventarioDirectoVentas_Ventas] } ON COLUMNS, NON EMPTY { (
[Dim_Tiempo_].[Anio].[Anio].ALLMEMBERS
* [Dim_Tiempo_].[Mes].[Mes].ALLMEMBERS
* [Dim_Tiempo_].[NombreMesAbreviado].[NombreMesAbreviado].ALLMEMBERS
* [Dim_PlantaCentro_].[IdGrupo].[IdGrupo].ALLMEMBERS
* [Dim_PlantaCentro_].[NombreGrupo].[NombreGrupo].ALLMEMBERS
* [Dim_PlantaCentro_].[IdDivision].[IdDivision].ALLMEMBERS
* [Dim_PlantaCentro_].[NombreDivision].[NombreDivision].ALLMEMBERS
* [Dim_PlantaCentro_].[IdPlanta].[IdPlanta].ALLMEMBERS
* [Dim_PlantaCentro_].[Planta].[Planta].ALLMEMBERS
* [Dim_ConceptosInventario_].[keyClave].[keyClave].ALLMEMBERS
* [Dim_ConceptosInventario_].[sNombreConcepto].[sNombreConcepto].ALLMEMBERS ) }
DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_VALUE, MEMBER_UNIQUE_NAME ON ROWS FROM [BSC] CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
它正确运行并返回所有字段,当我想添加参数Anio
和Mes
时会出现问题:
DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_VALUE, MEMBER_UNIQUE_NAME ON ROWS
FROM ( SELECT ( STRTOSET(@DimTiempoMes, CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET(@DimTiempoAnio, CONSTRAINED) ) ON COLUMNS FROM [BSC]))
CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
出于某种原因
[Measures].[InventarioDirectoVentas_VentaAcumulada]
和
[Measures].[InventarioDirectoVentas_Ventas]
从我的返回领域消失,我不知道为什么。这个字段的特殊之处在于它们可以返回null但是在添加参数之前它返回没有问题,现在使用Mes
和Anio
的过滤器它只是不返回字段,它们消失了。有人知道那里有什么问题吗?此致
答案 0 :(得分:0)
在列集之前删除非空:
SELECT {
[Measures].[InventarioDirectoInventario_Inventario],
[Measures].[InventarioDirectoInventario_InventarioAcumulado],
[Measures].[InventarioDirectoVentas_VentaAcumulada],
[Measures].[InventarioDirectoVentas_Ventas] } ON COLUMNS, NON EMPTY { (
[Dim_Tiempo_].[Anio].[Anio].ALLMEMBERS
* [Dim_Tiempo_].[Mes].[Mes].ALLMEMBERS
* [Dim_Tiempo_].[NombreMesAbreviado].[NombreMesAbreviado].ALLMEMBERS
* [Dim_PlantaCentro_].[IdGrupo].[IdGrupo].ALLMEMBERS
* [Dim_PlantaCentro_].[NombreGrupo].[NombreGrupo].ALLMEMBERS
* [Dim_PlantaCentro_].[IdDivision].[IdDivision].ALLMEMBERS
* [Dim_PlantaCentro_].[NombreDivision].[NombreDivision].ALLMEMBERS
* [Dim_PlantaCentro_].[IdPlanta].[IdPlanta].ALLMEMBERS
* [Dim_PlantaCentro_].[Planta].[Planta].ALLMEMBERS
* [Dim_ConceptosInventario_].[keyClave].[keyClave].ALLMEMBERS
* [Dim_ConceptosInventario_].[sNombreConcepto].[sNombreConcepto].ALLMEMBERS ) }
DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_VALUE, MEMBER_UNIQUE_NAME ON ROWS FROM [BSC] CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS