简体   繁体   English

根据不同列中的值创建一个表,显示 1 列中的所有值对组合 - Excel / Power BI

[英]Creating a Table Showing All Pair Combinations of Values in 1 Column Based on Values in a Different Column - Excel / Power BI

I have this table showing the names of the employees who worked on jobs where each job can be worked on by more than one employee:我有这张表显示从事工作的员工的姓名,每项工作可以由多个员工从事:

Table 1表格1

And I would like to create a new table comparing the names of the employees who worked on the same job so we could eventually compare their answers, two employees at time.我想创建一个新表来比较从事同一工作的员工的姓名,以便我们最终可以比较他们的答案,一次是两名员工。 It should look something like this:它应该看起来像这样:

Table 2表 2

So if a job was answered by 4 people, then I should end up with 6 rows for the job (4C2) and if it was answered by 16 people, then I should have 120 rows (16C2).因此,如果一项工作由 4 人回答,那么我应该以 6 行结束该工作(4C2),如果它由 16 人回答,那么我应该有 120 行(16C2)。

Is there any way I could do this in Excel or in Power BI?有什么办法可以在 Excel 或 Power BI 中做到这一点?

In Power Query :Power Query中:

  1. Select the Employee 1 Name and Employee 2 Name columns and then Unpivot Columns选择Employee 1 NameEmployee 2 Name列,然后Unpivot Columns
  2. Select the Job and resulting Value columns and then Remove Duplicates选择作业和结果列,然后Remove Duplicates
  3. Remove the Attribute column删除属性

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

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