English 中文(简体)
MSSQL Server 2008 BDS多维数据集中的计算度量值
原标题:Calculated measures in MSSQL Server 2008 BDS cube

我想定义3个计算成员。我有一个基于两个表的多维数据集,TrackInfo和图表位置。“图表位置”表由36个周列组成,其中包含给定曲目在给定周的前100名列表中的位置(如果歌曲没有出现在列表中,则为0):

[Entry ID] FOREIGN KEY,
[1st Week] FLOAT,
[2nd Week] FLOAT,

以此类推,直到第36周。

我想计算以下指标:

1) 这首歌进入前十的周数

2) 这首歌进入前20名的周数

3) “人气指数”,可通过以下公式计算:

1/((所有非零位置的平均值)*(37-(列表上显示的周数))

有人能帮我吗?

最佳回答

如果没有多维数据集定义,编写MDX有点困难,但1)我会举一个类似的问题为例——东京进入前三大销售城市的年份:

 select
  [Measures].[Sales] on 0,

  Filter( 

    Generate( [Time].[Year].[Year].members as s1, 
             TopCount( s1.currentMember * [Customers].[City].members, 3, [Measures].[Sales] ) 
    ) as s2,

    IIF( s2.current(1) IS [Customers].[Geography].[City].[Tokyo] , true, false )

  )

  on 1 

  from [Sales]

这适用于icCube;应该与AS相同,因为这是一个相当标准的MDX。我想你会用生成函数。然后,您可以创建一个计算度量值,该度量值将Count()过滤后的集合,而不是将该集合放在轴上(用于演示目的)。

问题回答

暂无回答




相关问题
Performance impact of indexed view in MS SQL Server 2008

Does anyone have experience with using indexed view in MS SQL Server 2008? I am trying to find out how does indexed view affect performance of insert / update statements, that are adding / updating ...

Lock Escalation - What s happening here?

While altering a table (removing a column) in SQL Server 2008, I clicked the Generate Change Script button and I noticed that the change script it generated drops the column, says "go" and then runs ...

Round to nearest 5 in SQL Server

I have a Money column in my SQL Server 2008 table. In my below query how can I round it to nearest 5$ select FineAmount from tickets Thanks

热门标签