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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Email Response time from Outlook Exchange

I am trying to calculate the first response time of the emails, also I am trying to figuring out how to match received emails to sent emails,  

 this is an example data, the actual data is thousands of rows long.

Folder PathSubjectdate time sent date time received IDSender AddressReceiver Address
\Sent Item\Re:Complaint for service11/17/2020 10:5411/17/2020 10:54aamkiushjjerjerjlCompany@mail.comCustomer@mail.com
\Reeceived item \Complaint for service11/16/2020 15:5411/16/2020 15:54aamkiushjjerjerjlCustomer@mail.comCompany@mail.com
\Sent Item\Re:Complaint for service11/17/2020 11:5411/17/2020 11:54aamkiushjjerjerjlCompany@mail.comCustomer@mail.com
\Sent Item\Re:Complaint for service11/17/2020 12:5411/17/2020 12:54aamkiushjjerjerjlCompany@mail.comCustomer@mail.com
\Reeceived item \Office timings11/16/2020 15:5411/16/2020 15:54lkjjasg12445@mail.comCompany@mail.com
\Sent Item\Followup11/16/2020 15:5411/16/2020 15:54hjjksieCompany@mail.com5433@mail.com

 

1) So my question is what is how to calculate the time between when the initial email was received and when the first response was sent? 

2) Additionally, I want to count those emails as well which are not actioned or respond 

Thanks in advance for your support 

 

1 ACCEPTED SOLUTION

Hello @Anonymous 

 

exactly, I choose the duration in minutues. 1140 minutes are 19 hours. You can change this also to hours. Just replace the Duration.TotalsMinutes to Duration.TotalHours. If you remove this function completely you will get a duration-value like 0.19:00:00

For sure you have to remove my resource steps with your query. This is only to show how to get the result. This kind of transformation you have to dig in the M-code :). If you are not able to apply my code, you can post your query here, then I can do it for you. But be aware that my solution works with your data provided. If your data is different, it may not work and we need to adapt it even more. 


If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy 

View solution in original post

10 REPLIES 10
agustinamar
New Member

Hi @Jimmy801 , I hope you can answer this question. I am working with an outlook database, and to know the days elapsed since an email with a case to be resolved is received until its resolution, but I would not know how to put together the formula (I have the dates of sent and received), since there would be many mails (different cases per client) I thought of doing it by subject: when it starts, put region_customername_test1 and when region_customername_resolved_test1 is resolved. Would you have any suggestion? Is this possible to do? Thank you in advance

Anonymous
Not applicable

mubarik_0-1605908794089.png

 

Anonymous
Not applicable

Considering I am a new user of Power BI, please tell me if I need to apply this query to real data. Are there any changes I need to make? as per your instructions after copying the same query, the system is giving me the test values.

BR

Anonymous
Not applicable

Can you help me with this? how can I do that? Thanks

Hello @Anonymous 

 

check out this solution. Applies Table.Group and analysis the create grouped table. 2 indicators are caclulated. Duration between Received and Min Sent mail. About your second request I'm not sure. Currently is shows true if in a conversation was find a Sent Item-mail. Here the M-code

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("tZHRCoIwFIZfZXgd6aYWdBUEQVeBXWoXw451dHPi1Ojt2yooUqKiYFffgf3f+U8cO0mygbIhqwZkkjgjJ4LZQslKcDQ0UzXRUHeYghlR6tKpyzzmEerNwmAYcS4LbPUhz6G2Txhmf+TlaS45inGqpEWtbpSE+s62I2sTAaSAHewIGiVycXolNLmlh3ehJzQo1EsfkLwKfVUP7ddDf1LPVzasb8P+dqx1lhkD0qDEcq/fvpIo8pzrvR2yIAg/PsxSCaGObfV2oNm50AjDC4eB7z/kbc8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Folder Path" = _t, Subject = _t, #"date time sent " = _t, #"date time received " = _t, ID = _t, #"Sender Address" = _t, #"Receiver Address" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Folder Path", type text}, {"Subject", type text}, {"date time sent ", type datetime}, {"date time received ", type datetime}, {"ID", type text}, {"Sender Address", type text}, {"Receiver Address", type text}}, "en-US"),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"ID"}, {{"AllRows", each _, type table [Folder Path=text, Subject=text, #"date time sent "=datetime, #"date time received "=datetime, ID=text, Sender Address=text, Receiver Address=text]}}),
    CreateResult = Table.AddColumn
    (
        #"Grouped Rows",
        "Result",
        (row)=> 
        let 
            HasSent = if List.Count(List.Select(row[AllRows][Folder Path], each _ = "\Sent Item\"))>0 then true else false,
            HasReceived = if List.Count(List.Select(row[AllRows][Folder Path], each _ = "\Reeceived item \"))>0 then true else false,
            DurationIfHasSentAndHasReceived = if HasSent = true and HasReceived = true then
                Duration.TotalMinutes(List.Min(Table.SelectRows(row[AllRows], each [Folder Path]= "\Sent Item\")[#"date time sent "]) - 
                Table.SelectRows(row[AllRows], each [Folder Path]= "\Reeceived item \")[#"date time sent "]{0})
                else 
                null
        in 
            [HasSent = HasSent, DurationReceivedAndFirstSentMail =DurationIfHasSentAndHasReceived  ]
    ),
    #"Expanded Result" = Table.ExpandRecordColumn(CreateResult, "Result", {"HasSent", "DurationReceivedAndFirstSentMail"}, {"HasSent", "DurationReceivedAndFirstSentMail"})
in
    #"Expanded Result"

 

Copy paste this code to the advanced editor in a new blank query to see how the solution works.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

Anonymous
Not applicable

@Jimmy801  I really appreciate your help and for the prompt response, here I am sharing the results the duration seems to me incorrect if you see the highlighted timings the response time should be 18 hours, can you please explain or something I am not doing right   

Thanks.

email.jpg

Hello @Anonymous 

 

exactly, I choose the duration in minutues. 1140 minutes are 19 hours. You can change this also to hours. Just replace the Duration.TotalsMinutes to Duration.TotalHours. If you remove this function completely you will get a duration-value like 0.19:00:00

For sure you have to remove my resource steps with your query. This is only to show how to get the result. This kind of transformation you have to dig in the M-code :). If you are not able to apply my code, you can post your query here, then I can do it for you. But be aware that my solution works with your data provided. If your data is different, it may not work and we need to adapt it even more. 


If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy 

Anonymous
Not applicable

Thanks. 

Jimmy801
Community Champion
Community Champion

Hello @Anonymous 

 

It's possible to use the ID-Column for grouping a conversation or it's needed to group by subject?

 

BR

 

Jimmy

Anonymous
Not applicable

Yes sure

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors