我正在尝试获取每个公司销售的前十名产品

时间:2019-03-28 12:51:07

标签: sql-server mdx-query

我尝试按照下面的链接所述进行操作

https://activeviam.com/en/resource-center/advanced-mdx-queries

但是我的查询花费了很长时间,然后超时错误。

SELECT NON EMPTY
Generate
(
   [Cube Company].[Name].MEMBERS,

   TopCount
   (
     {[Cube Company].[Name].CurrentMember} * [Cube Product].[ALL].
     [AllMember].Children,
     10,
     [Measures].[sales]
   )

) ON ROWS,
{MEASURES.[sales]} ON COLUMNS
FROM [DB];

我还尝试了示例查询,该查询在下一页中显示每个日历年的前10个产品,并带有过滤器和不带过滤器,并且仍然存在相同的错误:

https://docs.microsoft.com/en-us/sql/mdx/generate-mdx?view=sql-server-2017

SELECT NON EMPTY
{[Measures].[sales]} ON COLUMNS, 
Generate(
 [Cube Company].[Name].MEMBERS,
 TopCount(
        [Cube Company].[Name].CURRENTMEMBER 
        * FILTER([Cube Product].[Name].MEMBERS, [Measures].[sales]>0),
        10,
        [Measures].[sales]
        )
) ON ROWS
FROM [DB];

0 个答案:

没有答案