需要获得维度的所有成员减去一个成员的总和

发布于 2024-11-14 18:58:17 字数 331 浏览 1 评论 0原文

我正在尝试进行 MDX 查询,该查询可以告诉我有多少产品在中国以外的国家/地区销售。通过以下查询,我只能获取每个国家的瓶装水销售单位,但不能获取其总和。如何修改查询以获得其总和?

SELECT NON EMPTY Except(
   {[Location].[All Places].Children}, 
   {[Location].[China]}
) ON COLUMNS,
  {[Product].[All Products].[Bottled Water].Children} ON ROWS
FROM [Places]
WHERE [Measures].[Units Sold]

I am trying to make an MDX query that can tell me how many products were sold in countries other than China. With the following query I can only get the units sold of bottled water for each of the countries, but not their sum. How do I modify the query to get the sum of that ?

SELECT NON EMPTY Except(
   {[Location].[All Places].Children}, 
   {[Location].[China]}
) ON COLUMNS,
  {[Product].[All Products].[Bottled Water].Children} ON ROWS
FROM [Places]
WHERE [Measures].[Units Sold]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忱杏 2024-11-21 18:58:17

以下应该做你想做的事:

WITH 
  SET [countries] as Except( {[Location].[All Places].Children}, {[Location].[China]} )
  MEMBER [measures].[X] as Sum( [countries] , [Measures].[Units Sold] )

SELECT {[Product].[All Products].[Bottled Water].Children} ON ROWS 
FROM [Places] 
WHERE [measures].[x]

The following should do what you want:

WITH 
  SET [countries] as Except( {[Location].[All Places].Children}, {[Location].[China]} )
  MEMBER [measures].[X] as Sum( [countries] , [Measures].[Units Sold] )

SELECT {[Product].[All Products].[Bottled Water].Children} ON ROWS 
FROM [Places] 
WHERE [measures].[x]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文