As you can see from the image i have a one-to-many relation ship between these two tables. BUT i want to make it soo its a Many-to-many. Im using AssetID as the key for these relationships. Any ideas on how i could create this??
从图中可以看出,这两个表之间存在一对多关系。但我想让它如此多对多。我用资产资产作为这些关系的关键。有什么想法吗?
The reason whu need it as a Many-to-Many as im using this in powerview and using Column headers as sliders. An example of this would be if i was to select Windows 7 in the tblOperatingSystem slider the slider which i use for tblAssets would only display what is relevant to windows 7, where as i want to be able to do the opposite and select in tblAssets silder and only the OS would appear which is relevant in the tblOperatingSystem slider
为什么whu需要它作为多对多的,就像im在powerview中使用它,并使用列标题作为滑动条。的一个例子是如果我选择Windows 7在tblOperatingSystem滑块的滑块用于tblAssets只会显示有关Windows 7是什么,,我希望能够做相反的事情,选择在tblAssets滑盖,只有相关的操作系统会出现tblOperatingSystem滑块
I have already Tried to create a new table which just has AssetID and then connect tblAssets and tblOperatingSystem to it but this method doesnt work for the sliders.
我已经尝试过创建一个新的表,它只有AssetID,然后将tblAssets和tblOperatingSystem连接到它,但是这个方法对sliders不适用。
Any ideas round this?
任何想法这一轮?
2 个解决方案
#1
1
If I'm understanding the issue correctly, this is down to a limitation of PowerPivot (and the SSAS tabular model) in which it is unable to properly model many-to-many relationships. The relationship can be enforced in one direction (as you can see in your OS slider), but doesn't work on the other direction.
如果我正确地理解了这个问题,这是由于PowerPivot(以及SSAS表格模型)的局限性,在这种情况下,它无法正确地建模多对多关系。这种关系可以在一个方向上执行(正如您在OS slider中看到的),但不能在另一个方向上执行。
A way I've managed to work around this in PowerPivot/PowerView in the past is to create an additional, de-normalised table, which contains all possible combinations of OS and Asset, with a new identity column (or a concatenation of OSID
and AssetID
) as a Key. Configure the one-to-many relationships to tblOperatingSystem
and tblAsset
as required.
我过去在PowerPivot/PowerView中解决这个问题的一种方法是创建一个额外的、非规范化的表,它包含所有可能的OS和资产组合,并以一个新的标识列(或OSID和AssetID的连接)作为键。根据需要配置到tblOperatingSystem和tblAsset的一对多关系。
The critical part to this, is to include your data columns here also, using DAX functions to populate the values. You can then use this new de-normalised table as the source for both of your sliders (and hide the originals from the client), which will automatically filter each other when one is selected.
关键的部分是,在这里包含数据列,使用DAX函数填充值。然后,您可以使用这个新的非规范化表作为两个滑块的源(并向客户端隐藏原始数据),当一个滑块被选中时,它将自动地相互过滤。
Now, it's not terribly efficient as there's a lot of duplication, so if anyone else can suggest another way to achieve this, I'd be interested to hear it myself! Just beware of using this with really large data models, as it can slow things down a lot.
现在,它不是非常有效,因为有很多重复,所以如果有人能提出另一种方法来实现它,我很有兴趣亲自去听!只要注意不要在真正的大数据模型中使用它,因为它会使事情变慢很多。
Alternatively, I came across this article (which contains good links to similar posts by Marco Russo and Alberto Ferrari) but I haven't tried it out, so I'm not sure how well it plays with PowerView, since both source articles pre-date PV.
或者,我偶然发现了这篇文章(它包含了马可·鲁索(Marco Russo)和阿尔贝托·法拉利(Alberto Ferrari)类似文章的很好的链接),但是我还没有尝试过,所以我不确定它在PowerView上的表现如何,因为这两篇文章的源代码都是在PV之前写的。
#2
0
PowerPivot doesn't support many-to-many relationship modeling nativly but you can emulate it using DAX. All you need to do is in you measure list the related many-to-many tables in your calculate statment. For example (from http://gbrueckl.wordpress.com/2012/05/08/resolving-many-to-many-relationships-leveraging-dax-cross-table-filtering/) given a layout like:
PowerPivot不支持多对多关系建模,但您可以使用DAX来模拟它。您需要做的就是在计算状态中列出相关的多对多表。例如(来自http://gbrueckl.wordpress.com/2012/05/08/resoling-many -to- relationship- leveraging-dax-cross-table-filtering/)给出如下布局:
Then to write a measure on the Audience table that counts the number of rows but takes into account the filtering on the Targets table you would write:
然后,要在听众表上写一个度量值,该度量值计算行数,但要考虑到对目标表的过滤,您可以这样写:
RowCount_M2M:=CALCULATE(
[RowCount],
'Individuals',
'TargetsForIndividuals',
'Targets')
By listing the other tables their filter contexts will overlap and you get the joining you are looking for.
通过列出其他表,它们的筛选上下文将重叠,您将得到您要查找的连接。
#1
1
If I'm understanding the issue correctly, this is down to a limitation of PowerPivot (and the SSAS tabular model) in which it is unable to properly model many-to-many relationships. The relationship can be enforced in one direction (as you can see in your OS slider), but doesn't work on the other direction.
如果我正确地理解了这个问题,这是由于PowerPivot(以及SSAS表格模型)的局限性,在这种情况下,它无法正确地建模多对多关系。这种关系可以在一个方向上执行(正如您在OS slider中看到的),但不能在另一个方向上执行。
A way I've managed to work around this in PowerPivot/PowerView in the past is to create an additional, de-normalised table, which contains all possible combinations of OS and Asset, with a new identity column (or a concatenation of OSID
and AssetID
) as a Key. Configure the one-to-many relationships to tblOperatingSystem
and tblAsset
as required.
我过去在PowerPivot/PowerView中解决这个问题的一种方法是创建一个额外的、非规范化的表,它包含所有可能的OS和资产组合,并以一个新的标识列(或OSID和AssetID的连接)作为键。根据需要配置到tblOperatingSystem和tblAsset的一对多关系。
The critical part to this, is to include your data columns here also, using DAX functions to populate the values. You can then use this new de-normalised table as the source for both of your sliders (and hide the originals from the client), which will automatically filter each other when one is selected.
关键的部分是,在这里包含数据列,使用DAX函数填充值。然后,您可以使用这个新的非规范化表作为两个滑块的源(并向客户端隐藏原始数据),当一个滑块被选中时,它将自动地相互过滤。
Now, it's not terribly efficient as there's a lot of duplication, so if anyone else can suggest another way to achieve this, I'd be interested to hear it myself! Just beware of using this with really large data models, as it can slow things down a lot.
现在,它不是非常有效,因为有很多重复,所以如果有人能提出另一种方法来实现它,我很有兴趣亲自去听!只要注意不要在真正的大数据模型中使用它,因为它会使事情变慢很多。
Alternatively, I came across this article (which contains good links to similar posts by Marco Russo and Alberto Ferrari) but I haven't tried it out, so I'm not sure how well it plays with PowerView, since both source articles pre-date PV.
或者,我偶然发现了这篇文章(它包含了马可·鲁索(Marco Russo)和阿尔贝托·法拉利(Alberto Ferrari)类似文章的很好的链接),但是我还没有尝试过,所以我不确定它在PowerView上的表现如何,因为这两篇文章的源代码都是在PV之前写的。
#2
0
PowerPivot doesn't support many-to-many relationship modeling nativly but you can emulate it using DAX. All you need to do is in you measure list the related many-to-many tables in your calculate statment. For example (from http://gbrueckl.wordpress.com/2012/05/08/resolving-many-to-many-relationships-leveraging-dax-cross-table-filtering/) given a layout like:
PowerPivot不支持多对多关系建模,但您可以使用DAX来模拟它。您需要做的就是在计算状态中列出相关的多对多表。例如(来自http://gbrueckl.wordpress.com/2012/05/08/resoling-many -to- relationship- leveraging-dax-cross-table-filtering/)给出如下布局:
Then to write a measure on the Audience table that counts the number of rows but takes into account the filtering on the Targets table you would write:
然后,要在听众表上写一个度量值,该度量值计算行数,但要考虑到对目标表的过滤,您可以这样写:
RowCount_M2M:=CALCULATE(
[RowCount],
'Individuals',
'TargetsForIndividuals',
'Targets')
By listing the other tables their filter contexts will overlap and you get the joining you are looking for.
通过列出其他表,它们的筛选上下文将重叠,您将得到您要查找的连接。