MDX 查询问题 - 不需要的输出
Issues with MDX query - unwanted output
我正在尝试从我在业务中使用的多维数据集中提取一些数据,其中包含数百万数据。我正在使用 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 并进行操作以添加 运行 我的业务所需的临时措施。
我将不胜感激 =) 谢谢!
试试下面的查询
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
我正在尝试从我在业务中使用的多维数据集中提取一些数据,其中包含数百万数据。我正在使用 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 并进行操作以添加 运行 我的业务所需的临时措施。 我将不胜感激 =) 谢谢!
试试下面的查询
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