简体   繁体   English

Power Bi 中的 AHT 计算

[英]AHT calculation in Power Bi

I am facing challenges to present the AHT (average handled time) for calls handled data in power Bi.我在为 Power Bi 中的呼叫处理数据呈现 AHT(平均处理时间)方面面临挑战。

AHT = (Total Handled time)/Total calls handled.

Now if I have to show the AHT for Q1 in Excel.现在,如果我必须在 Excel 中显示Q1AHT We use sumproduct formula to calculate it.我们使用sumproduct公式来计算它。

在此处输入图像描述

formula= =SUMPRODUCT(E3:E5,F3:F5)/SUM(E3:E5)

However, I am not able to do it in PowerBi.但是,我无法在 PowerBi 中做到这一点。

if you can convert your Excel data as format shown in the image (just converted to hh:mm:ss ), you can apply below steps on your data to achieve your required output-如果您可以将 Excel 数据转换为图像中显示的格式(刚刚转换为hh:mm:ss ),您可以对数据应用以下步骤以实现所需的输出 -

在此处输入图像描述

Power query will be as below after you import excel data to power BI-将excel数据导入power BI后,电量查询如下-

let
Source = Excel.Workbook(File.Contents("D:\WORK\R&D\Book2.xlsx"), null, true),
Sheet8_Sheet = Source{[Item="Sheet8",Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(Sheet8_Sheet, [PromoteAllScalars=true]),
#"Added Custom" = Table.AddColumn(#"Promoted Headers", "Custom", each [AHT] - DateTime.FromText("1899-12-31")),
#"Duplicated Column" = Table.DuplicateColumn(#"Added Custom", "Custom", "Custom - Copy"),
#"Calculated Total Seconds" = Table.TransformColumns(#"Duplicated Column",{{"Custom - Copy", Duration.TotalSeconds, type number}}),
#"Added Custom1" = Table.AddColumn(#"Calculated Total Seconds", "Custom.1", each [calls_handled] * [#"Custom - Copy"]),
#"Renamed Columns" = Table.RenameColumns(#"Added Custom1",{{"Custom.1", "Total Second"}})
in
#"Renamed Columns"

After applying above steps, you will have final data as below-应用上述步骤后,您将获得以下最终数据-

在此处输入图像描述

Now you can create your measure as below-现在您可以按如下方式创建您的度量 -

avg_time = SUM([Total Second])/SUM(month)

The returned value will be in Second.返回值将以秒为单位。 There are formula in DAX through which you will be able to conver Seconds to HH:mm:ss as per your requirement. DAX 中有公式,您可以通过它根据您的要求将 Seconds 转换为 HH:mm:ss。

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

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