按维度排序mdx

时间:2018-01-25 05:59:34

标签: reporting-services mdx ssrs-2012

我有这个MDX:

WITH MEMBER [Measures].[InventarioSobreVentas] AS [Measures].[InventarioDirecto_Monto]/[Measures].[VentasInventarioDirecto_Ventas]*100 SELECT NON EMPTY {
 [Measures].[InventarioDirecto_Monto], 
[Measures].[VentasInventarioDirecto_Ventas], [Measures].[InventarioSobreVentas] } ON COLUMNS, NON EMPTY { (

[Dim_Tiempo_].[Anio].[Anio].ALLMEMBERS 
*[Dim_Tiempo_].[NombreMesAbreviado].[NombreMesAbreviado].ALLMEMBERS
* [Dim_Tiempo_].[Mes].[Mes].ALLMEMBERS
* [Dim_Tiempo_].[Dim_Tiempo_].[Dim_Tiempo_].ALLMEMBERS
* [Dim_PlantaConsolidada_].[Grupo].[Grupo].ALLMEMBERS 
* [Dim_PlantaConsolidada_].[IdGrupo].[IdGrupo].ALLMEMBERS
 * [Dim_PlantaConsolidada_].[Unidad].[Unidad].ALLMEMBERS
 * [Dim_PlantaConsolidada_].[IdUnidad].[IdUnidad].ALLMEMBERS
 * [Dim_PlantaConsolidada_].[sNombrePlantaConsolidada].[sNombrePlantaConsolidada].ALLMEMBERS 
* [Dim_PlantaConsolidada_].[keyIdPlantaConsolidada].[keyIdPlantaConsolidada].ALLMEMBERS 
* [Dim_ConceptosInventario_].[Dim_ConceptosInventario_].[Dim_ConceptosInventario_]
 )}
 DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_VALUE, MEMBER_UNIQUE_NAME ON ROWS 
--FROM ( SELECT ( {[Dim_PlantaConsolidada_].[keyIdPlantaConsolidada].[All] } ) ON COLUMNS 
FROM ( SELECT ( STRTOSET(@DimPlantaConsolidadaSNombrePlanta, CONSTRAINED) ) ON COLUMNS 

FROM ( SELECT ( STRTOSET(@DimPlantaConsolidadaIdUnidad, 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

正如您所看到的,我有一个名为

的专栏
* [Dim_Tiempo_].[Mes].[Mes].ALLMEMBERS

结果如下: enter image description here

值1到12,问题是我需要按升序排序,如1,2,3,4,5,6,7,8,9,10,11,12但mdx是如此复杂,我试着使用ORDER过滤器,但我总是得到错误。 Dimension无法订购?

1 个答案:

答案 0 :(得分:0)

您可以在所有设置的行周围放置ORDER:

...
NON EMPTY 
ORDER( 
     [Dim_Tiempo_].[Anio].[Anio].ALLMEMBERS 
    *[Dim_Tiempo_].[NombreMesAbreviado].[NombreMesAbreviado].ALLMEMBERS
    *[Dim_Tiempo_].[Mes].[Mes].ALLMEMBERS
    *[Dim_Tiempo_].[Dim_Tiempo_].[Dim_Tiempo_].ALLMEMBERS
    *[Dim_PlantaConsolidada_].[Grupo].[Grupo].ALLMEMBERS 
    *[Dim_PlantaConsolidada_].[IdGrupo].[IdGrupo].ALLMEMBERS
    *[Dim_PlantaConsolidada_].[Unidad].[Unidad].ALLMEMBERS
    *[Dim_PlantaConsolidada_].[IdUnidad].[IdUnidad].ALLMEMBERS
    *[Dim_PlantaConsolidada_].[sNombrePlantaConsolidada].[sNombrePlantaConsolidada].ALLMEMBERS 
    *[Dim_PlantaConsolidada_].[keyIdPlantaConsolidada].[keyIdPlantaConsolidada].ALLMEMBERS 
    *[Dim_ConceptosInventario_].[Dim_ConceptosInventario_].[Dim_ConceptosInventario_]
  ,[Dim_Tiempo_].[Mes].CURRENTMEMBER.MEMBER_CAPTION //<<OR [Dim_Tiempo_].[Mes].CURRENTMEMBER.MEMBERVALUE
  ,BASC
)  
ON ROWS 
...