Many-to-many relationship in SSAS Tabular project

家住魔仙堡 提交于 2019-12-24 13:03:19

问题


I'm trying to set up a many-to-many relationship in SSAS Tabular.

I've got the following in my tabular project (sales, customers, customer emails):

A sale is tied to a customer. A customer can have multiple emails.

How would I create a list of all emails that fit the current filter of a pivot table?

For example, I could create a pivot table shows "accounts with margin < 20%", and want a list of all emails associated with those accounts.

Sample, starting with the following sales data:

customer #  | revenue
1234        | 100
6789        | 50

I would expect to see something like (depending on the exact pivot table settings)

1234      
  one@sample.com    | 100
  two@sample.com    | 100
6789      
  three@sample.com  | 50

(one@sample.com and two@sample.com are both tied to the same account)

Instead I get:

  1234
    one@sample.com    | 100
    two@sample.com    | 100
    three@sample.com  | 100
  5678
    one@sample.com    | 50
    two@sample.com    | 50
    three@sample.com  | 50

回答1:


I'm not sure if this would solve your problem but I solved my problem by creating a bridge relationship between the two many to many tables. I couldn't find the exact article that I used but this one looks like it explains it:

http://brentgreenwood.blogspot.com/2011/12/case-for-bridge-tables.html

In your cube designer when you go to Dimension Usage one of the options is a "Many-to-Many". The connecting "bridge" table should just have the identities of the two connecting dimension and fact table. I know I didn't explain anything specific to your problem but perhaps this might help you get pointed in the right direction.




回答2:


Many-to-may relationship is not supported in SQL Server 2012 and 2014. SQL Server 2016 will contain this missing feature. The simple work around to solve this issue is to place all related tables in filter. This shortcut worked in my environment. Example is given below for your reference. Measure1:=calculate(sum[sales],'Customer','Emails')

Do let me know after try.



来源:https://stackoverflow.com/questions/19660509/many-to-many-relationship-in-ssas-tabular-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!