Power Bi:Link 表

Power Bi: Link Tables

在 power bi 中,我有一个 table Customer,其中保存了客户的 ID、姓名和其他详细信息。我有另一个名为 Customer_CustomerRole_Mapping 的 table,其中包含 CustomerId 及其 CustomerRoleId。我还有另一个 table 名称 CustomerRoles,其中包含每个角色的名称和 ID。

CustomerRolesCustomer_CustomerRole_Mapping 链接在一起。

在 Power Bi 中,我想在饼图中显示客户计数角色?我试过了,但我无法在这些 table 之间应用链接。我是 Power Bi 新手。

请找出table关系是单向还是双向。如果它很复杂并且你要走两种方式那么它就不会显示。

你的 Tables:

  • 客户
  • 角色
  • CustomerInRole

您的报告不需要 Table "Customer",因为您只需要知道 "Role" 中每行的行数 "CustomerInRole"。所以只需添加一个饼图,使用轴(或图例)中的角色名称和 "CustomerInRole"

中字段 "CustomerIDs" 的(不同)计数

这就是你所需要的;-)

为了清楚起见,我会将角色添加到您客户的 table。当您开始使用 BI 时,以相关的方式保持事物是没有用的。

这可以在查询编辑器中轻松完成。在主页选项卡上,单击 "Edit Queries"

然后您必须单击 "Merge queries",也在完全位于右侧的主页选项卡上。

在上方 table 您 select CustomerID 列和 Customer_CustomerRole_Mapping table,select table 的正确 ID .单击 "Ok" 后,您可以展开新列(通过右键单击合并的查询列)。您必须重复此步骤才能将角色添加到客户 table,但在第二轮中,您必须使用 select 角色 ID。

完成所有这些之后,您可以从此 table 中删除不再需要的列并保留该角色。

在饼图中,您只需添加角色和 select "Count"。

当你有其他Fact-table,并且你想使用Role作为Dimension时,这样解决很方便。

您可以在 power bi 桌面中 linking of tables 转到仪表板并单击图像中显示的第三个菜单 Relation Management data table image 无论您想要什么都可以与 table 只需在多个和单个 table 中拖放到 link 与 parent 和 child table s,如果你想删除这个关系继续关系箭头(线) 右键单击​​线并将其删除并保存文件。 干杯。