1

私のキューブには、エンティティに加えられたすべての変更の行を含むファクト テーブルがあります。必要なのは、選択したディメンションに基づいてエンティティの数を返すメジャーです。したがって、ユーザーが日付ディメンションから月を選択した場合、メジャーは (変更の数ではなく) その月に変更されたエンティティの数を返す必要があります。

SQL では、これは次のようになります。

SELECT EntityID, COUNT(*)
FROM FactTable
WHERE Date BETWEEN X AND Y
GROUP BY EntityID

MDXでこれを行うにはどうすればよいですか? 確かに、これはキューブでは非常に一般的なシナリオです。

4

1 に答える 1

3

Your t-sql query is equivalent of mdx query:

select 
    [Measures].[<Fact rows count measure>] on columns, 
    <Entity dimension members> on rows 
from [<Cube Name>] 
where (<month member>)

In the above query [Fact rows count measure] would be a measure with aggregation formula Count - count of rows However, if you need to return the distinct count of entity members when you slice by another dimension, you basically have several options:

  1. create a distinct count measure on the entityID key
  2. create a calculated measure with expression: count(exists(existing [Entity].[Entity].[Entity].MEMBERS,,'Measure Group Name'))

HTH, Hrvoje Piasevoli

于 2011-04-02T19:13:50.243 に答える