SSAS Aggregation on Distinct ID

前端 未结 1 1000
我在风中等你
我在风中等你 2021-01-27 10:04

I wish to change the default aggregation from SUM to SUM on Distinct ID Values. This is the current behaviour

     ID    Amount
      1      $10
      1      $10
            


        
1条回答
  •  北海茫月
    2021-01-27 10:34

    Design your data as a many-to-many relationship: create one table/view having one record per ID and the amount column from the data shown in your question (the main fact table), and one table/view having one record per record of your data as shown in your question, presumably having another column, as otherwise it would not make any sense to have the data as shown in your question). This will be the m2m dimension table. Then, create a bridge table/view having the id of the m2m dimension table and your ID column.

    Then create the following AS objects: A measure group from the main fact table, a dimension on column ID of the same table (in case there is no other column making a dimension table meaningful, in that case, you would better have a separate dimension table having ID as the primary key). Create a dimension from the m2m dimension table, and a measure group having only the invisible measure "count" from the bridge table. Finally, on the "Dimension Usage" tab of Cube Designer, set the relationship between the m2m dimension and the main measure group to be many to many via the bridge measure group.

    See http://technet.microsoft.com/en-us/library/ms170463.aspx for a tutorial on many-to-many relationships.

    0 讨论(0)
提交回复
热议问题