MDX 填补空白
MDX Filling gaps
我有一个问题;
SELECT
[Measures].[PersonelMasrafTutarSicileGore] ON COLUMNS,
non empty
[DimDimension2CostCenterView].[CostCenterFullName].[CostCenterFullName] *
[DimSicilBilgileri].[NAME].[NAME] *
[DimSicilBilgileri].[SURNAME].[SURNAME] *
[DimSicilBilgileri].[RSICILNO].[RSICILNO]*
[DimLedgerMasrafHierarchy].[GVHFMMASRAFCINSI].GVHFMMASRAFCINSI].ALLMEMBERS *
[DimLedgerMasrafHierarchy].[ACCOUNTNUM].[ACCOUNTNUM].ALLMEMBERS *
[DimDateView].[MonthOfYear].[MonthOfYear]*
[DimDateView].[MonthName].[MonthName]
ON ROWS
FROM ( SELECT ( STRTOSET("{[DimDateView].[Year].&[2016]}", CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET("{[BridgeSatisMuhasebeMM].[DimDimension2CostCenterViewKey].&[S_IHRACAT]}", CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET("{[DimDateView].[MonthOfYear].&[1],[DimDateView].[MonthOfYear].&[2]}", CONSTRAINED) ) ON COLUMNS
FROM [Model])))
结果是;
很好。我想要实现的是将有间隙的月份值添加为 0。例如,选择 MonthOfYear 值 1 和 2。因此对于第一行和 accountnum 760.454.02,我想获取 MonthOfYear 2 和值为 0 的行。像那样,对于 accountnum 760.402.01 的第二行,MonthOfYear 1 的值应该为 0。如果可能的话,如果 [DimLedgerMasrafHierarchy] 没有值,我想为两个给定的 MonthOfYear 值都获得 0 值,例如;
我怎样才能做到这一点?
也许可以使用 NonEmpty
和 NON EMPTY
:
SELECT
[Measures].[PersonelMasrafTutarSicileGore] ON COLUMNS,
NonEmpty(
[DimDimension2CostCenterView].[CostCenterFullName].[CostCenterFullName]
*[DimSicilBilgileri].[NAME].[NAME]
*[DimSicilBilgileri].[SURNAME].[SURNAME]
*[DimSicilBilgileri].[RSICILNO].[RSICILNO]
*[DimLedgerMasrafHierarchy].[GVHFMMASRAFCINSI].GVHFMMASRAFCINSI].ALLMEMBERS
,[Measures].[PersonelMasrafTutarSicileGore]
)
*[DimLedgerMasrafHierarchy].[ACCOUNTNUM].[ACCOUNTNUM].ALLMEMBERS
*[DimDateView].[MonthOfYear].[MonthOfYear]
*[DimDateView].[MonthName].[MonthName]
ON ROWS
FROM ( SELECT ( STRTOSET("{[DimDateView].[Year].&[2016]}", CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET("{[BridgeSatisMuhasebeMM].[DimDimension2CostCenterViewKey].&[S_IHRACAT]}", CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET("{[DimDateView].[MonthOfYear].&[1],[DimDateView].[MonthOfYear].&[2]}", CONSTRAINED) ) ON COLUMNS
FROM [Model])));
我不完全理解您的意见 - 尝试将所有层次结构从 [DimLedgerMasrafHierarchy]
维度移出 NonEmpty
函数:
SELECT
[Measures].[PersonelMasrafTutarSicileGore] ON COLUMNS,
NonEmpty(
[DimDimension2CostCenterView].[CostCenterFullName].[CostCenterFullName]
*[DimSicilBilgileri].[NAME].[NAME]
*[DimSicilBilgileri].[SURNAME].[SURNAME]
*[DimSicilBilgileri].[RSICILNO].[RSICILNO]
,[Measures].[PersonelMasrafTutarSicileGore]
)
*[DimLedgerMasrafHierarchy].[GVHFMMASRAFCINSI].GVHFMMASRAFCINSI].ALLMEMBERS
*[DimLedgerMasrafHierarchy].[ACCOUNTNUM].[ACCOUNTNUM].ALLMEMBERS
*[DimDateView].[MonthOfYear].[MonthOfYear]
*[DimDateView].[MonthName].[MonthName]
ON ROWS
FROM ( SELECT ( STRTOSET("{[DimDateView].[Year].&[2016]}", CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET("{[BridgeSatisMuhasebeMM].[DimDimension2CostCenterViewKey].&[S_IHRACAT]}", CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET("{[DimDateView].[MonthOfYear].&[1],[DimDateView].[MonthOfYear].&[2]}", CONSTRAINED) ) ON COLUMNS
FROM [Model])));
我有一个问题;
SELECT
[Measures].[PersonelMasrafTutarSicileGore] ON COLUMNS,
non empty
[DimDimension2CostCenterView].[CostCenterFullName].[CostCenterFullName] *
[DimSicilBilgileri].[NAME].[NAME] *
[DimSicilBilgileri].[SURNAME].[SURNAME] *
[DimSicilBilgileri].[RSICILNO].[RSICILNO]*
[DimLedgerMasrafHierarchy].[GVHFMMASRAFCINSI].GVHFMMASRAFCINSI].ALLMEMBERS *
[DimLedgerMasrafHierarchy].[ACCOUNTNUM].[ACCOUNTNUM].ALLMEMBERS *
[DimDateView].[MonthOfYear].[MonthOfYear]*
[DimDateView].[MonthName].[MonthName]
ON ROWS
FROM ( SELECT ( STRTOSET("{[DimDateView].[Year].&[2016]}", CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET("{[BridgeSatisMuhasebeMM].[DimDimension2CostCenterViewKey].&[S_IHRACAT]}", CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET("{[DimDateView].[MonthOfYear].&[1],[DimDateView].[MonthOfYear].&[2]}", CONSTRAINED) ) ON COLUMNS
FROM [Model])))
结果是;
很好。我想要实现的是将有间隙的月份值添加为 0。例如,选择 MonthOfYear 值 1 和 2。因此对于第一行和 accountnum 760.454.02,我想获取 MonthOfYear 2 和值为 0 的行。像那样,对于 accountnum 760.402.01 的第二行,MonthOfYear 1 的值应该为 0。如果可能的话,如果 [DimLedgerMasrafHierarchy] 没有值,我想为两个给定的 MonthOfYear 值都获得 0 值,例如;
我怎样才能做到这一点?
也许可以使用 NonEmpty
和 NON EMPTY
:
SELECT
[Measures].[PersonelMasrafTutarSicileGore] ON COLUMNS,
NonEmpty(
[DimDimension2CostCenterView].[CostCenterFullName].[CostCenterFullName]
*[DimSicilBilgileri].[NAME].[NAME]
*[DimSicilBilgileri].[SURNAME].[SURNAME]
*[DimSicilBilgileri].[RSICILNO].[RSICILNO]
*[DimLedgerMasrafHierarchy].[GVHFMMASRAFCINSI].GVHFMMASRAFCINSI].ALLMEMBERS
,[Measures].[PersonelMasrafTutarSicileGore]
)
*[DimLedgerMasrafHierarchy].[ACCOUNTNUM].[ACCOUNTNUM].ALLMEMBERS
*[DimDateView].[MonthOfYear].[MonthOfYear]
*[DimDateView].[MonthName].[MonthName]
ON ROWS
FROM ( SELECT ( STRTOSET("{[DimDateView].[Year].&[2016]}", CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET("{[BridgeSatisMuhasebeMM].[DimDimension2CostCenterViewKey].&[S_IHRACAT]}", CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET("{[DimDateView].[MonthOfYear].&[1],[DimDateView].[MonthOfYear].&[2]}", CONSTRAINED) ) ON COLUMNS
FROM [Model])));
我不完全理解您的意见 - 尝试将所有层次结构从 [DimLedgerMasrafHierarchy]
维度移出 NonEmpty
函数:
SELECT
[Measures].[PersonelMasrafTutarSicileGore] ON COLUMNS,
NonEmpty(
[DimDimension2CostCenterView].[CostCenterFullName].[CostCenterFullName]
*[DimSicilBilgileri].[NAME].[NAME]
*[DimSicilBilgileri].[SURNAME].[SURNAME]
*[DimSicilBilgileri].[RSICILNO].[RSICILNO]
,[Measures].[PersonelMasrafTutarSicileGore]
)
*[DimLedgerMasrafHierarchy].[GVHFMMASRAFCINSI].GVHFMMASRAFCINSI].ALLMEMBERS
*[DimLedgerMasrafHierarchy].[ACCOUNTNUM].[ACCOUNTNUM].ALLMEMBERS
*[DimDateView].[MonthOfYear].[MonthOfYear]
*[DimDateView].[MonthName].[MonthName]
ON ROWS
FROM ( SELECT ( STRTOSET("{[DimDateView].[Year].&[2016]}", CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET("{[BridgeSatisMuhasebeMM].[DimDimension2CostCenterViewKey].&[S_IHRACAT]}", CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( STRTOSET("{[DimDateView].[MonthOfYear].&[1],[DimDateView].[MonthOfYear].&[2]}", CONSTRAINED) ) ON COLUMNS
FROM [Model])));