[英]Filter mdx query result
I have a MDX query that return result like this: 我有一个MDX查询,返回的结果如下:
Customer | 客户| Store | 店铺| Sales 营业额
A | A | Store_1 | 商店_1 | 123.45 123.45
A | A | Store_2 | 商店_2 | 234.56 234.56
B | B | Store_2 | 商店_2 | 345.67 345.67
B | B | Store_3 | Store_3 | 456.78 456.78
C | C | Store_1 | 商店_1 | 543.21 543.21
C | C | Store_3 | Store_3 | 654.32 654.32
How the query should look to have result that show only one row per customer with the first store only: 查询的外观应如何使结果显示每个客户仅在第一家商店中仅显示一行:
A | A | Store_1 | 商店_1 | 123.45 123.45
B | B | Store_2 | 商店_2 | 345.67 345.67
C | C | Store_1 | 商店_1 | 543.21 543.21
Update: Actual query 更新:实际查询
SELECT
[Measures].[Sales] ON COLUMNS,
NON EMPTY(
[Customers].[User].[User], [Stores].[Store].[Store]
) ON ROWS
FROM SALES
If I run this: 如果我运行此命令:
SELECT
[Measures].[Internet Sales Amount] ON 0
,
[Product].[Category].[Category]
*
[Customer].[Customer Geography].[Country] ON 1
FROM [Adventure Works];
I get the following: 我得到以下内容:
If I just want the first
for each category I need to do something like this: 如果我只想要每个类别的first
,则需要执行以下操作:
WITH
SET [cats] AS
[Product].[Category].[Category]
SET [cats_country] AS
Generate
(
[cats] AS S
,
S.Current
*
Head(NonEmpty([Customer].[Customer Geography].[Country],S.Current))
)
SELECT
[Measures].[Internet Sales Amount] ON 0
,[cats_country] ON 1
FROM [Adventure Works];
Results in this: 结果:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.