我是MDX的新手,我遇到了一个小问题,希望他们可以帮助我。
我有一个包含以下查询的分析图表:
WITH
MEMBER [Articulo].[Art_Linea].[ Aggregation] AS
Aggregate({[Articulo].[Art_Linea].&[3M],[Articulo].[Art_Linea].&[Bendix]})
,SOLVE_ORDER = 0
SELECT
Hierarchize
(
{
[Almacen].[Alm_Nombre].&[MATRIZ]
,[Almacen].[Alm_Nombre].&[TOLUCA]
}
)
*
{
[Measures].[Val]
,[Measures].[Disponible]
} ON COLUMNS
,Hierarchize
(
{
[Articulo].[LCD].[Art_Linea].&[3M]
,[Articulo].[LCD].[Art_Linea].&[Bendix]
}
) ON ROWS
FROM [Inventario]
WHERE
[Articulo].[Art_Linea].[ Aggregation]
CELL PROPERTIES
VALUE
,FORMATTED_VALUE
,CELL_ORDINAL
,FONT_FLAGS
,FORE_COLOR
,BACK_COLOR;
返回以下网格:
我想为每个“Articulo LCD”添加一个“Totals”列,其中包含“MATRIZ”和“TOLUCA”列的“Val”和“Disponible”度量的总和。
你能指导我怎么做吗?我不确定如何实现“Sum”功能。
事先非常感谢你。
问候!
答案 0 :(得分:0)
也许试试这个:
WITH
MEMBER [Articulo].[Art_Linea].[ Aggregation] AS
Aggregate({[Articulo].[Art_Linea].&[3M],[Articulo].[Art_Linea].&[Bendix]})
,SOLVE_ORDER = 0
MEMBER [Articulo].[LCD].[All].[3M+Bendix] AS //<<you might need to play around here - maybe this is correct name?: [Articulo].[LCD].[All].[Art_Linea].[3M+Bendix]
Sum
(
{
[Articulo].[LCD].[Art_Linea].&[3M]
,[Articulo].[LCD].[Art_Linea].&[Bendix]
}
)
SELECT
Hierarchize
(
{
[Almacen].[Alm_Nombre].&[MATRIZ]
,[Almacen].[Alm_Nombre].&[TOLUCA]
}
)
*
{
[Measures].[Val]
,[Measures].[Disponible]
} ON COLUMNS
,Hierarchize
(
{
[Articulo].[LCD].[Art_Linea].&[3M]
,[Articulo].[LCD].[Art_Linea].&[Bendix]
,[Articulo].[LCD].[All].[3M+Bendix] //<<you might need to play around here - maybe this is correct name?: [Articulo].[LCD].[All].[Art_Linea].[3M+Bendix]
}
) ON ROWS
FROM [Inventario]
WHERE
[Articulo].[Art_Linea].[ Aggregation];
虽然我对聚合成员的目的不太了解 - 所以可能只是以下内容?
WITH
MEMBER [Articulo].[LCD].[All].[3M+Bendix] AS //<<you might need to play around here - maybe this is correct name?: [Articulo].[LCD].[All].[Art_Linea].[3M+Bendix]
Sum
(
{
[Articulo].[LCD].[Art_Linea].&[3M]
,[Articulo].[LCD].[Art_Linea].&[Bendix]
}
)
SELECT
Hierarchize
(
{
[Almacen].[Alm_Nombre].&[MATRIZ]
,[Almacen].[Alm_Nombre].&[TOLUCA]
}
)
*
{
[Measures].[Val]
,[Measures].[Disponible]
} ON COLUMNS
,Hierarchize
(
{
[Articulo].[LCD].[Art_Linea].&[3M]
,[Articulo].[LCD].[Art_Linea].&[Bendix]
,[Articulo].[LCD].[All].[3M+Bendix] //<<you might need to play around here - maybe this is correct name?: [Articulo].[LCD].[All].[Art_Linea].[3M+Bendix]
}
) ON ROWS
FROM [Inventario];