新的PowerBi和Power查询,并有一些困难的数据转换。
数据包含每个销售类别的流程,如果生产过程已经完成或没有完成,则为每个销售类别提供状态。需要一个具有三个计算列的新聚合表,该表返回以下日期:
进程进入table
。
已经成功地返回了这三个日期,但是每个日期都在一个单独的行上,而不是与数据一起的一行。下面是原始数据和所需的输出。

输出表

如果能帮助转换这些数据,我将不胜感激。
发布于 2021-08-21 12:41:18
大多数情况下,您可以使用来完成:
Month/Category/Process
但是,您需要一个自定义聚合,其中在状态列中筛选“完成”的子表后确定最大日期。
您可以在高级编辑器中直接编辑M代码。
M码
let
Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Month", type date},
{"Category", type text}, {"Process", type text}, {"Status", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Month", "Category", "Process"}, {
{"Start Date", each List.Min([Date]), type nullable date},
{"Predicted End Date", each List.Max([Date]), type nullable date},
//Custom aggregation to calculate Actual End Date
//Note that we can Filter the table here, and then select the last date
{"Actual End Date", each List.Max(Table.SelectRows(_, each [Status]= "Done")[Date]), type nullable date}
})
in
#"Grouped Rows"原始数据

结果

https://stackoverflow.com/questions/68871976
复制相似问题