简体   繁体   中英

AHT calculation in Power Bi

I am facing challenges to present the AHT (average handled time) for calls handled data in power Bi.

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

Now if I have to show the AHT for Q1 in Excel. We use sumproduct formula to calculate it.

在此处输入图像描述

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

However, I am not able to do it in 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-

在此处输入图像描述

Power query will be as below after you import excel data to 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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