简体   繁体   English

Excel Power Pivot-多对多关系

[英]Excel Power Pivot - Many 2 Many Relationship

I have just started to use Power Pivot and my first real world problem involves a many to many relationship. 我刚开始使用Power Pivot,而我的第一个现实世界问题涉及多对多关系。 I am looking to show the quantity of each child item required each month as a consequence of the demand for the parent items and the parent / child relationships. 我希望显示由于对父项的需求以及父/子关系而需要的每个子项的数量。 I have created relationships as below using a unique list of items in Item Master to provide a 1 to Many relationship with the two tables. 我已经使用Item Master中的项目的唯一列表创建了如下所示的关系,以提供与两个表的一对多关系。

I have created a calculated column in the Relationship table but the quantity of each item is the same each month although total qty appears correct in the Pivot Table. 我已经在“关系”表中创建了一个计算列,但是每个项目的数量每个月都是相同的,尽管“透视表”中的总数量看来是正确的。

=CALCULATE(sum(ItemDemand[Qty]),Relationship[Child Item])`

Any ideas gratefully received 感谢收到任何想法

Thanks 谢谢

I couldn't quite reproduce your incorrect table, but think I got the one you are after using the following measure. 我无法完全重现您不正确的表,但在使用以下方法后,我想我得到了您要使用的表。

=CALCULATE(SUM(ItemDemand[Qty]),
           FILTER(Relationship,
                  Relationship[Child Item] IN VALUES(Relationship[Child Item])))

Without adding this filter argument, the filtering only flows downwards in your relationship diagram. 不添加此过滤器参数,过滤仅在关系图中向下流动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM