如何在Excel的数据模型中创建多对多关系?

时间:2022-10-05 13:43:11

We have an issue with power BI where we cannot use a many-many relationship to do calculations.

我们遇到了电源BI的问题,我们不能使用很多关系来进行计算。

End goal is Column E: 如何在Excel的数据模型中创建多对多关系?

最终目标是E栏:

Initial Table #1:

初始表#1:

如何在Excel的数据模型中创建多对多关系?

Initial Table #2:

初始表#2:

如何在Excel的数据模型中创建多对多关系?

When I use the Average Price per Area of Initial Table #2 on the Initial Table #1[Item] as the Rows element, I will get a warning: Relationships between tables maybe needed. But the issue is Power Bi in Excel does not support a many-many relationship yet.

当我使用初始表#1 [Item]上的初始表#2的每个区域的平均价格作为Rows元素时,我将收到警告:可能需要表之间的关系。但问题是Excel中的Power Bi还不支持很多关系。

As can be seen, the Pivot Table is not displaying correctly as there is no item green. I have another database with more SKUs and it's all displaying #NUM there because it cannot reference the items despite having the same name.

可以看出,由于没有项目绿色,数据透视表未正确显示。我有另一个包含更多SKU的数据库,并且它们都在那里显示#NUM,因为它尽管具有相同的名称但无法引用这些项目。

如何在Excel的数据模型中创建多对多关系?

1 个解决方案

#1


3  

Create a third table that contains unique items, i.e,

创建包含唯一项的第三个表,即

Table 3:

Column "Item"
Blue
Green
Red
...

Then connect both initial tables to it using field "Item".

然后使用字段“Item”将两个初始表连接到它。

Put "Item" from the third table on pivot rows, and your report should work (assuming your DAX formulas are correctly written).

将第三个表中的“Item”放在数据透视表行上,并且您的报表应该有效(假设您的DAX公式已正确写入)。

#1


3  

Create a third table that contains unique items, i.e,

创建包含唯一项的第三个表,即

Table 3:

Column "Item"
Blue
Green
Red
...

Then connect both initial tables to it using field "Item".

然后使用字段“Item”将两个初始表连接到它。

Put "Item" from the third table on pivot rows, and your report should work (assuming your DAX formulas are correctly written).

将第三个表中的“Item”放在数据透视表行上,并且您的报表应该有效(假设您的DAX公式已正确写入)。