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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.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 如何在M查询中添加其他行_Powerbi_Dax_Powerquery_Powerbi Desktop_M - Fatal编程技术网

Powerbi 如何在M查询中添加其他行

Powerbi 如何在M查询中添加其他行,powerbi,dax,powerquery,powerbi-desktop,m,Powerbi,Dax,Powerquery,Powerbi Desktop,M,我想使用查询编辑器(Power Query/M Query)仅在“开始日期”和“结束日期”列中添加更多行: +----------+------------------+--------------+-----------+-------------+------------+ | Employee | Booking Type | Jobs | WorkLoad% | Start Date | End date | +----------+------------

我想使用查询编辑器(Power Query/M Query)仅在“开始日期”和“结束日期”列中添加更多行:

+----------+------------------+--------------+-----------+-------------+------------+
| Employee |  Booking Type    |     Jobs     | WorkLoad% | Start Date  |  End date  |
+----------+------------------+--------------+-----------+-------------+------------+
| John     | Chargeable       | CNS          |        20 | 04/02/2020  | 31/03/2020 |
| John     | Chargeable       | CNS          |        20 | 04/03/2020  | 27/04/2020 |
| Bernard  | Vacation/Holiday | SN           |       100 | 30/04/2020  | 11/05/2020 |
| Bernard  | Vacation/Holiday | Annual leave |       100 | 23/01/2020  | 24/02/2020 |
| Bernard  | Chargeable       | Tech PLC     |        50 | 29/02/2020  | 30/03/2020 |
+----------+------------------+--------------+-----------+-------------+------------+
我想找到
MIN(开始日期)
MAX(结束日期)
,然后仅在查询编辑器(Power Query/M Query)的“开始日期”和“结束日期”列中将开始到结束日期的范围追加到此表中。如果我可以创建另一个表2复制原始表并附加这些行,则更可取。 例如:

+----------+------------------+--------------+-----------+-------------+------------+
| Employee |  Booking Type    |     Jobs     | WorkLoad% | Start Date  |  End date  |
+----------+------------------+--------------+-----------+-------------+------------+
| John     | Chargeable       | CNS          |        20 | 04/02/2020  | 31/03/2020 |
| John     | Chargeable       | CNS          |        20 | 04/03/2020  | 27/04/2020 |
| Bernard  | Vacation/Holiday | SN           |       100 | 30/04/2020  | 11/05/2020 |
| Bernard  | Vacation/Holiday | Annual leave |       100 | 23/01/2020  | 24/02/2020 |
| Bernard  | Chargeable       | Tech PLC     |        50 | 29/02/2020  | 30/03/2020 |
|          |                  |              |           | 23/01/2020  | 23/01/2020 |
|          |                  |              |           | 24/01/2020  | 24/01/2020 |
|          |                  |              |           | 25/01/2020  | 25/01/2020 |
|          |                  |              |           | 26/01/2020  | 26/01/2020 |
|          |                  |              |           | 27/01/2020  | 27/01/2020 |
|          |                  |              |           | 28/01/2020  | 28/01/2020 |
|          |                  |              |           | 29/01/2020  | 29/01/2020 |
|          |                  |              |           | 30/01/2020  | 30/01/2020 |
|          |                  |              |           | 31/01/2020  | 31/01/2020 |
|          |                  |              |           | ...         | ...        |
|          |                  |              |           | 11/05/2020  | 11/05/2020 |
+----------+------------------+--------------+-----------+-------------+------------+
这是非常有用的

生成范围内的日期,将其复制到两列,然后追加

let
    StartDate = List.Min(StartTable[Start Date]),
    EndDate = List.Max(StartTable[End Date]),
    DateList = List.Dates(StartDate, Duration.Days(EndDate - StartDate), #duration(1,0,0,0)),
    DateCols = Table.FromColumns({DateList, DateList}, {"Start Date", "End Date"}),
    AppendDates = Table.Combine({StartTable, DateCols})
in
    AppendDates