我需要从立方体中获得每个州的前50名卖家名称
这是我到目前为止所拥有的
SELECT NON EMPTY ( [DimGeo].[State].[State].ALLMEMBERS *
[Measures].[Total Sales]) ON COLUMNS,
NON EMPTY TOPCOUNT([DimEmployee].[Employee ID].[EmployeeID].MEMBERS,50,[Measures].[Total Sales]) ON ROWS
FROM Sales
但这只得到50个结果(即使一个州没有50个结果)。我想将状态结果限制为50个非空的最高值。
示例:决赛桌将有2500个结果(每50个州排名前50位)。
有没有办法实现这个目标?
谢谢,
答案 0 :(得分:4)
我猜您正在寻找Generate()功能:
SELECT
NON EMPTY ( [Measures].[Total Sales]) ON COLUMNS,
NON EMPTY Generate( [DimGeo].[State].[State].ALLMEMBERS as s,
TOPCOUNT(s.currentMember * [DimEmployee].[Employee ID].[EmployeeID].MEMBERS, 50, [Measures].[Total Sales] ))
ON ROWS FROM fdmdw
答案 1 :(得分:0)
通过将状态移动到行级别,这对您有用吗?
SELECT NON EMPTY ( [Measures].[Total Sales]) ON COLUMNS,
NON EMPTY ([DimGeo].[State].[State].ALLMEMBERS * TOPCOUNT([DimEmployee].[Employee ID].[EmployeeID].MEMBERS,50,[Measures].[Total Sales])) ON ROWS
FROM fdmdw