Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Converting a Qlik statement to Power BI

I am trying to convert a Qlik statement to Power BI and have been unsuccessful.

This is the original statement: 

Avg(Aggr,"(Interval(Min({<CALLS_IN_OUT_SK={2}, CALLS_MEDIACLASS_SK={70634}, CALLS_CALLDISPOSITION_DESC={"All reservations were completed"}>} CALLS_BEGANROUTINGDATETIME_DT) - Min({<CALLS_CALLDISPOSITION_DESC={"Callback Requested"}>} CALLS_BEGANROUTINGDATETIME_DT),'hh:mm:ss')) + (Avg({<CALLS_IN_OUT_SK={1}, CALLS_MEDIACLASS_SK={70634}, CALLS_CALLDISPOSITION_DESC={"Callback Requested"}>} CALLS_NETQTIME)/86400)

 

This is what I have come up with. Unfortunatly the results are not the same.

CB Response Time =

CALCULATE(MIN(Telephony[CALLS_BEGANROUTINGDATETIME]),Telephony[IN_OUT_SK]=2,Telephony[CALLS_MEDIACLASS_SK]=70634, Telephony[CALLDISPOSITION_DESC]="ALL RESERVATIONS WERE COMPLETED") - Calculate(MIN(Telephony[CALLS_TIME]),Telephony[CALLDISPOSITION_DESC]="CALLBACK REQUESTED")
+CALCULATE(AVERAGE(Telephony[CALLS_NETQTIME]),Telephony[IN_OUT_SK]=1,Telephony[CALLS_MEDIACLASS_SK]=70634, Telephony[CALLDISPOSITION_DESC]="CALLBACK REQUESTED")/86400

 

For the most part I am using all of the same fields with the exception of [Calls_Time] replaced [calls_beganroutingdatetime] in the second line of the staaement.

 

Thanks in advance for any support.

 

6 REPLIES 6
Anonymous
Not applicable

The results I am trying to get to is the total amount of time it takes once a callback has been requested and the callback has ben completed. 

Anonymous
Not applicable

Hi @Anonymous ,

 

It will be much easier for us to get the result if you could tell us the filter conditions and expected result.

 

Best Regards,

Jay

BeaBF
Super User
Super User

@Anonymous Hi!

Can you paste some sample data and the expected result? it would be easier...

 

Thx,

BF.

Anonymous
Not applicable

Here is a sample of the data. What I need to do is get the average amopunt of time it takes from Call back requested to call back completed. 

CALLS_BEGANROUTINGDATETIMEIN_OUT_SKCALLDISPOSITION_DESCCALLS_MEDIACLASS_SKCALLS_NETQTIMECALLS_TIMECOMPLETEDCALLBACKCALLBACKREQUEUESCALLBACKATTEMPTS
4/4/2022 00:39:311ALL RESERVATIONS WERE COMPLETED70634612:39:31 AM000
4/4/2022 03:36:101ALL RESERVATIONS WERE COMPLETED70634603:36:10 AM000
4/4/2022 05:36:371ALL RESERVATIONS WERE COMPLETED70634705:36:37 AM000
4/4/2022 05:51:321ALL RESERVATIONS WERE COMPLETED7063469405:51:32 AM000
4/4/2022 06:35:181ALL RESERVATIONS WERE COMPLETED70634706:35:18 AM000
4/4/2022 06:48:581HANGUP70634 06:48:58 AM000
4/4/2022 06:51:021ALL RESERVATIONS WERE COMPLETED70634706:51:02 AM000
4/4/2022 06:59:051ALL RESERVATIONS WERE COMPLETED706347106:59:05 AM000
4/4/2022 07:00:161HANGUP70634007:00:16 AM000
4/4/2022 07:06:551ALL RESERVATIONS WERE COMPLETED70634707:06:55 AM000
4/4/2022 07:10:471ALL RESERVATIONS WERE COMPLETED70634807:10:47 AM000
4/4/2022 07:13:011ALL RESERVATIONS WERE COMPLETED706341007:13:01 AM000
4/4/2022 07:14:431ALL RESERVATIONS WERE COMPLETED70634607:14:43 AM000
4/4/2022 07:32:471ALL RESERVATIONS WERE COMPLETED70634707:32:47 AM000
4/4/2022 07:33:011ALL RESERVATIONS WERE COMPLETED70634707:33:01 AM000

@Anonymous which are the two fields between  you want to calculate the average? CALLS_BEGANROUTINGDATETIME and....?

 

BF.

Anonymous
Not applicable

Based on the qlik script there is only one column CALLS_BEGANROUTINGDATETIME but there are conditions or filters. I have tried writing it like this to make it easier for me. It might help.

Measure =

VAR _Response =CALCULATE(MIN(Telephony[CALLS_BEGANROUTINGDATETIME]),Telephony[IN_OUT_SK]=2,Telephony[CALLS_MEDIACLASS_SK]=70634, Telephony[CALLDISPOSITION_DESC]="ALL RESERVATIONS WERE COMPLETED")VAR _Start =CALCULATE(MIN(Telephony[CALLS_TIME]),Telephony[CALLDISPOSITION_DESC]="CALLBACK REQUESTED")
VAR _QTime =CALCULATE(AVERAGE(Telephony[CALLS_NETQTIME]),Telephony[IN_OUT_SK]=1,Telephony[CALLS_MEDIACLASS_SK]=70634, Telephony[CALLDISPOSITION_DESC]="CALLBACK REQUESTED")/86400

VAR _AHTCALC = _Response / _Start + _QTime

--MTTR Formatted =
VAR MTTR =_AHTCALC
VAR Hours = TRUNC ( MTTR )
VAR MinSec = FORMAT ( MAX ( MTTR - Hours, 0 ) / 24, "h:nn:ss" )
RETURN
IF ( NOT ISBLANK ( _AHTCALC ), Hours & MinSec )

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.