Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powerbi 追加之后,我在主表头中得到空值_Powerbi_Powerquery_M - Fatal编程技术网

Powerbi 追加之后,我在主表头中得到空值

Powerbi 追加之后,我在主表头中得到空值,powerbi,powerquery,m,Powerbi,Powerquery,M,我有一个表,我想用作另一个只有数据的表的标题。我在PBI中使用append作为new,使用headers表作为主表,使用data表作为辅助表。主表中的所有列都有空值,数据表将追加到headers列的旁边 例如: 表1(标题) 表2(数据) 我在追加后得到的表: +------+------+------+------+------+------+------+------+ | ABC | DEF | IGH | KLM | null | null | null | null | +-

我有一个表,我想用作另一个只有数据的表的标题。我在PBI中使用append作为new,使用headers表作为主表,使用data表作为辅助表。主表中的所有列都有空值,数据表将追加到headers列的旁边

例如:

表1(标题)

表2(数据)

我在追加后得到的表:


+------+------+------+------+------+------+------+------+
| ABC  | DEF  | IGH  | KLM  | null | null | null | null |
+------+------+------+------+------+------+------+------+
| null | null | null | null |    1 |    2 |    3 |    4 |
| null | null | null | null |    6 |    7 |    8 |    9 |
| null | null | null | null |   11 |   12 |   13 |   14 |
| null | null | null | null |   16 |   17 |   18 |   19 |
| null | null | null | null |   21 |   22 |   23 |   24 |
| null | null | null | null |   26 |   27 |   28 |   29 |
| null | null | null | null |   31 |   32 |   33 |   34 |
+------+------+------+------+------+------+------+------+



表一需要:


+-----+-----+-----+-----+
| ABC | DEF | IGH | KLM |
+-----+-----+-----+-----+
|   1 |   2 |   3 |   4 |
|   6 |   7 |   8 |   9 |
|  11 |  12 |  13 |  14 |
|  16 |  17 |  18 |  19 |
|  21 |  22 |  23 |  24 |
|  26 |  27 |  28 |  29 |
|  31 |  32 |  33 |  34 |
+-----+-----+-----+-----+


我在PBI中使用Append作为new 使用headers表(表1)作为主表,并将表2附加到它

这在顶部功能中显示:

= Table.Combine({Table 1, Table 2})
这将在高级编辑器中显示:

let
    Source = Table.Combine({Sheet1, InterviewQn})
in
    Source
预期结果:

+-----+-----+-----+-----+
| ABC | DEF | IGH | KLM |
+-----+-----+-----+-----+
|   1 |   2 |   3 |   4 |
|   6 |   7 |   8 |   9 |
|  11 |  12 |  13 |  14 |
|  16 |  17 |  18 |  19 |
|  21 |  22 |  23 |  24 |
|  26 |  27 |  28 |  29 |
|  31 |  32 |  33 |  34 |
+-----+-----+-----+-----+


如果您只是尝试使用表1的列名重命名表2的列,那么它只是:

= Table.RenameColumns(#"Table 2", List.Zip({Table.ColumnNames(#"Table 2"), Table.ColumnNames(#"Table 1")}))

参见工作示例PBIX文件

我是Power BI新手,我不知道我必须首先应用查询,然后为联合创建计算表。我在这上面花了太多时间。谢谢你,谢谢你。这将是另一种方法,使用DAX。但我的答案中的查询行在Power查询中,在加载到数据模型之前执行您想要的操作。
+-----+-----+-----+-----+
| ABC | DEF | IGH | KLM |
+-----+-----+-----+-----+
|   1 |   2 |   3 |   4 |
|   6 |   7 |   8 |   9 |
|  11 |  12 |  13 |  14 |
|  16 |  17 |  18 |  19 |
|  21 |  22 |  23 |  24 |
|  26 |  27 |  28 |  29 |
|  31 |  32 |  33 |  34 |
+-----+-----+-----+-----+
+-----+-----+-----+-----+
| ABC | DEF | IGH | KLM |
| 1   | 2   | 3   | 4   |
| 6   | 7   | 8   | 9   |
| 11  | 12  | 13  | 14  |
| 16  | 17  | 18  | 19  |
| 21  | 22  | 23  | 24  |
| 26  | 27  | 28  | 29  |
| 31  | 32  | 33  | 34  |
+-----+-----+-----+-----+
= Table.RenameColumns(#"Table 2", List.Zip({Table.ColumnNames(#"Table 2"), Table.ColumnNames(#"Table 1")}))