将行转换为 MDX SSAS 中的列
convert rows to columns in MDX SSAS
SELECT
NON EMPTY
{[Measures].[Fact Employee Count]} ON COLUMNS
,NON EMPTY
{
[Dim Date].[Calendar].[Date].ALLMEMBERS
*
[Dim Emp Type].[Hierarchy].[Emp Type].ALLMEMBERS
} ON ROWS
FROM [People Dashboard];
查询结果:
出于某种原因,我需要将 Emp Type 转换为列,因此它变成这样:
年份 |季度 |月份 |日期 |日工 |康特拉克 |中期计划 |马岗 |柏科班 | TETAP
2016年 |第三 |七月 | 2016-07-11|第1134章4584 | 56 | 331 | 4 | 8391
如何达到我想要的结果?
这是一个可能的方法
WITH
MEMBER [Measures].[DAILY WORKER] AS
(
[Measures].[Fact Employee Count]
,[Dim Emp Type].[Hierarchy].[Emp Type].[DAILY WORKER]
)
MEMBER [Measures].[KONTRAK] AS
(
[Measures].[Fact Employee Count]
,[Dim Emp Type].[Hierarchy].[Emp Type].[KONTRAK]
)
MEMBER [Measures].[MTP] AS
(
[Measures].[Fact Employee Count]
,[Dim Emp Type].[Hierarchy].[Emp Type].[MTP]
)
MEMBER [Measures].[MAGANG] AS
(
[Measures].[Fact Employee Count]
,[Dim Emp Type].[Hierarchy].[Emp Type].[MAGANG]
)
MEMBER [Measures].[PERCOBAAN] AS
(
[Measures].[Fact Employee Count]
,[Dim Emp Type].[Hierarchy].[Emp Type].[PERCOBAAN]
)
MEMBER [Measures].[TETAP] AS
(
[Measures].[Fact Employee Count]
,[Dim Emp Type].[Hierarchy].[Emp Type].[TETAP]
)
SELECT
NON EMPTY
{
[Measures].[DAILY WORKER]
,[Measures].[KONTRAK]
,[Measures].[MTP]
,[Measures].[MAGANG]
,[Measures].[PERCOBAAN]
,[Measures].[TETAP]
} ON 0
,NON EMPTY
{
[Dim Date].[Calendar].[Date].ALLMEMBERS
} ON 1
FROM [People Dashboard];
SELECT
NON EMPTY
{[Measures].[Fact Employee Count]} ON COLUMNS
,NON EMPTY
{
[Dim Date].[Calendar].[Date].ALLMEMBERS
*
[Dim Emp Type].[Hierarchy].[Emp Type].ALLMEMBERS
} ON ROWS
FROM [People Dashboard];
查询结果:
出于某种原因,我需要将 Emp Type 转换为列,因此它变成这样:
年份 |季度 |月份 |日期 |日工 |康特拉克 |中期计划 |马岗 |柏科班 | TETAP 2016年 |第三 |七月 | 2016-07-11|第1134章4584 | 56 | 331 | 4 | 8391
如何达到我想要的结果?
这是一个可能的方法
WITH
MEMBER [Measures].[DAILY WORKER] AS
(
[Measures].[Fact Employee Count]
,[Dim Emp Type].[Hierarchy].[Emp Type].[DAILY WORKER]
)
MEMBER [Measures].[KONTRAK] AS
(
[Measures].[Fact Employee Count]
,[Dim Emp Type].[Hierarchy].[Emp Type].[KONTRAK]
)
MEMBER [Measures].[MTP] AS
(
[Measures].[Fact Employee Count]
,[Dim Emp Type].[Hierarchy].[Emp Type].[MTP]
)
MEMBER [Measures].[MAGANG] AS
(
[Measures].[Fact Employee Count]
,[Dim Emp Type].[Hierarchy].[Emp Type].[MAGANG]
)
MEMBER [Measures].[PERCOBAAN] AS
(
[Measures].[Fact Employee Count]
,[Dim Emp Type].[Hierarchy].[Emp Type].[PERCOBAAN]
)
MEMBER [Measures].[TETAP] AS
(
[Measures].[Fact Employee Count]
,[Dim Emp Type].[Hierarchy].[Emp Type].[TETAP]
)
SELECT
NON EMPTY
{
[Measures].[DAILY WORKER]
,[Measures].[KONTRAK]
,[Measures].[MTP]
,[Measures].[MAGANG]
,[Measures].[PERCOBAAN]
,[Measures].[TETAP]
} ON 0
,NON EMPTY
{
[Dim Date].[Calendar].[Date].ALLMEMBERS
} ON 1
FROM [People Dashboard];