【问题标题】:Recent call date & latest agent name最近通话日期和最新代理人姓名
【发布时间】:2023-01-11 16:43:59
【问题描述】:

问题陈述:对于特定的“Id”,我如何选择最近呼叫的代理人的首次呼叫日期和姓名

期望的输出:例如:这里 ID 16468 的第一个呼叫日期是 02-01-2023 & 最近呼叫的代理将是 ANGEL,它基于该特定 ID 的最近呼叫日期

enter image description here当前场景

enter image description here 期望的输出

如何在 power 查询代码中获得高于预期的输出?

我尝试使用此代码创建不同的“Id”表和单独的日期表,但我无法显示最近针对每个不同的“Id”调用的首次呼叫日期和代理名称

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Id", Int64.Type}, {"call date", type datetime}, {"Agent name", type text}}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Changed Type",{{"call date", type date}}),
    
    Unique_Tablerows = Table.Distinct(Table.SelectColumns(#"Changed Type1", "Id")),
    DateOnly_Table = Table.SelectColumns(#"Changed Type1", "call date")
    
    
in
    DateOnly_Table

【问题讨论】:

    标签: powerquery


    【解决方案1】:

    试试下面。下次请过去的样本作为文本而不是图像

    请注意,根据您的要求,您的样本输出很混乱,因为如果您正在寻找一个 ID,您不能重复两次

    let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"call date", type date}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Id"}, {
        {"call date", each List.Min([call date]), type nullable date},
        {"Agent name", each Table.LastN(Table.Sort(_,{{"call date", Order.Ascending}}),1){0}[Agent name], type text}
    })
    in  #"Grouped Rows"
    

    【讨论】:

      猜你喜欢
      • 2014-08-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多