我有一个按年份排列的前5名客户,我想创建一个查询,在不同的年份同时获得这些信息,我的意思是。
select
[Measures].[Ventas]
on columns,
non empty
topcount
(
[Dim Cliente].[Company Name].Children,5,[Measures].[Ventas]
)
on rows
from
[DWH Northwind]
where
[Dim Tiempo].[Año].&[1996]
1996年的前5名
我可以得到1996年和1997年的前5名一起分开每年?
你可以使用 生成 功能如下。
select
[Measures].[Ventas] on columns,
non empty Generate(
{ [Dim Tiempo].[Año].&[1995], [Dim Tiempo].[Año].&[1996] } as yy,
topcount (yy.currentMember * [Dim Cliente].[Company Name].Children,5,[Measures].[Ventas])
) on rows
from [DWH Northwind
这样你就可以用同样的方法 检索出每个可用年份的前五名。
select
[Measures].[Ventas] on columns,
non empty Generate(
[Dim Tiempo].[Año].members as yy,
topcount (yy.currentMember * [Dim Cliente].[Company Name].Children,5,[Measures].[Ventas])
) on rows
from [DWH Northwind
希望对你有帮助
试试这个
select
[Measures].[Ventas]
on columns,
non empty
{
topcount
(([Dim Tiempo].[Año].&[1996],[Dim Cliente].[Company Name].Children),5,[Measures].[Ventas])
,
topcount
(([Dim Tiempo].[Año].&[1997],[Dim Cliente].[Company Name].Children),5,[Measures].[Ventas])
}
on rows
from
[DWH Northwind]
where