0

我正在尝试从我在业务中使用的具有数百万数据的多维数据集中提取一些数据。我正在使用 MDX,我对它很陌生,我正在尝试复制我的一个数据透视表的输出。我创建了查询,似乎一切都在正确的位置,但是输出似乎是反转的(列上的行和行上的列,请参阅图片了解详细信息)由于某种原因,我无法弄清楚如何修复它。

此图像显示了所需的输出和实际输出:这是我正在使用的查询:

SELECT NON EMPTY CrossJoin(CrossJoin(CrossJoin(CrossJoin(CrossJoin(Hierarchize({DrilldownLevel({[Dem 
Product].[Dem Product Hierarchy].[All]},,,INCLUDE_CALC_MEMBERS)}), 
Hierarchize({DrilldownLevel({[TheDate].[Fiscal Year].[All]},,,INCLUDE_CALC_MEMBERS)})), 
Hierarchize({DrilldownLevel({[TheDate].[Quarter].[All]},,,INCLUDE_CALC_MEMBERS)})),
Hierarchize({DrilldownLevel({[TheDate].[Month].[All]},,,INCLUDE_CALC_MEMBERS)})),
Hierarchize({DrilldownLevel({[Running].[Business].[All]},,,INCLUDE_CALC_MEMBERS)})),
Hierarchize({DrilldownLevel({[Reporting].[segment].[All]},,,INCLUDE_CALC_MEMBERS)}))
DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME 
ON COLUMNS 
FROM 
(SELECT 
({[Dem Product].[Dem Product Hierarchy].[Dem allProducts].&[ProductX],
[Dem Product].[Dem Product Hierarchy].[Dem allProducts].&[ProductY], 
[Dem Product].[Dem Product Hierarchy].[Dem allProducts].&[ProductZ],
[Dem Product].[Dem Product Hierarchy].[Dem allProducts].&[ProductA],
[Dem Product].[Dem Product Hierarchy].[Dem allProducts].&[ProductB], 
[Dem Product].[Dem Product Hierarchy].[Dem allProducts].&[ProductC],
[Dem Product].[Dem Product Hierarchy].[Dem allProducts].&[ProductD],
{[Reporting].[segment].&[Online telecom], 
[Reporting].[segment].&[Online shop],    
[Reporting].[segment].&[ground sales], 
[Reporting].[segment].&[Retail],   
[Reporting].[segment].&[third party]})
ON COLUMNS

FROM [SalesCube])

WHERE 
([Reporting.[UPSegment].&[1stDivision],
[Measures].[BusinessRevenue]) CELL PROPERTIES VALUE,
FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS

我想要输出的原因是我可以将数据导入 power bi 并进行操作以添加运行我的业务所需的临时措施。非常感谢我能得到的任何帮助 =) 谢谢!

4

1 回答 1

0

试试下面的查询

SELECT NON EMPTY CrossJoin(CrossJoin(CrossJoin(CrossJoin(CrossJoin(Hierarchize({DrilldownLevel({[Dem 
Product].[Dem Product Hierarchy].[All]},,,INCLUDE_CALC_MEMBERS)}), 
Hierarchize({DrilldownLevel({[TheDate].[Fiscal Year].[All]},,,INCLUDE_CALC_MEMBERS)})), 
Hierarchize({DrilldownLevel({[TheDate].[Quarter].[All]},,,INCLUDE_CALC_MEMBERS)})),
Hierarchize({DrilldownLevel({[TheDate].[Month].[All]},,,INCLUDE_CALC_MEMBERS)})),
Hierarchize({DrilldownLevel({[Running].[Business].[All]},,,INCLUDE_CALC_MEMBERS)})),
Hierarchize({DrilldownLevel({[Reporting].[segment].[All]},,,INCLUDE_CALC_MEMBERS)}))
DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME 
ON rows,
[Measures].[BusinessRevenue] on columns

FROM 
(SELECT 
({[Dem Product].[Dem Product Hierarchy].[Dem allProducts].&[ProductX],
[Dem Product].[Dem Product Hierarchy].[Dem allProducts].&[ProductY], 
[Dem Product].[Dem Product Hierarchy].[Dem allProducts].&[ProductZ],
[Dem Product].[Dem Product Hierarchy].[Dem allProducts].&[ProductA],
[Dem Product].[Dem Product Hierarchy].[Dem allProducts].&[ProductB], 
[Dem Product].[Dem Product Hierarchy].[Dem allProducts].&[ProductC],
[Dem Product].[Dem Product Hierarchy].[Dem allProducts].&[ProductD],
{[Reporting].[segment].&[Online telecom], 
[Reporting].[segment].&[Online shop],    
[Reporting].[segment].&[ground sales], 
[Reporting].[segment].&[Retail],   
[Reporting].[segment].&[third party]})
ON COLUMNS

FROM [SalesCube])

WHERE 
([Reporting.[UPSegment].&[1stDivision]) CELL PROPERTIES VALUE,
FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS
于 2020-03-05T22:15:41.207 回答