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
rjs2
Resolver I
Resolver I

Email Response Time from email chain (email object in salesforce)

Hi!  I have been trying to figure how to get response time from customer emails by our staff. 

 

The problem I am running into is that I cant figure out how to get the calculate time within an email chain with multiple responses.  Usinger 'earlier' just calculates it from the first two.  I do have my emails ranked.

 

I want to do this calculation in DAX and not in power query

 

This is what I have thats just giving me first incoming email and first outbound email:

ResponseTimeAll =
var cust_first_email_time = CALCULATE(MIN('Email Message'[MessageDate]),FILTER('Email Message','Email Message'[ParentId]=EARLIER('Email Message'[ParentId]) && 'Email Message'[Incoming]=TRUE()))
var ren_first_email_time = CALCULATE(MIN('Email Message'[MessageDate]),FILTER('Email Message','Email Message'[ParentId]=EARLIER('Email Message'[ParentId]) && 'Email Message'[Incoming]=FALSE()))
return DATEDIFF(cust_first_email_time,ren_first_email_time,minute)
1 ACCEPTED SOLUTION
rjs2
Resolver I
Resolver I

Ok, I am a bit closer now due to finding this:

https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-service-response-ti...

ResponseTimeAll =
SUMX (
    VALUES ('Email Message'[ParentId] ),
    CALCULATE (
        IF (
            MAX ( 'Email Message'[IncomingText])="TRUE",
            VAR X = MAX ( 'Email Message'[MessageDate] )
            VAR FilteredTable =
                FILTER (
                    CALCULATETABLE (
                        'Email Message',
                        ALLEXCEPT ( 'Email Message', 'Email Message'[ParentId] )
                    ),
                    'Email Message'[MessageDate] > X && 'Email Message'[IncomingText]="FALSE"
                )
            VAR Y = MINX ( FilteredTable, 'Email Message'[MessageDate]  )
            VAR TimeDuration = DATEDIFF ( X, Y, SECOND )
            VAR Result = DIVIDE ( TimeDuration, 60 )
            RETURN
                Result
        ))
)

 

I had to make some ammendments, but Its calculating on the incoming email the time til the next outgoing email.

We have auto response on, so I need to find away to mark those and have it skip the auto response

View solution in original post

1 REPLY 1
rjs2
Resolver I
Resolver I

Ok, I am a bit closer now due to finding this:

https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-service-response-ti...

ResponseTimeAll =
SUMX (
    VALUES ('Email Message'[ParentId] ),
    CALCULATE (
        IF (
            MAX ( 'Email Message'[IncomingText])="TRUE",
            VAR X = MAX ( 'Email Message'[MessageDate] )
            VAR FilteredTable =
                FILTER (
                    CALCULATETABLE (
                        'Email Message',
                        ALLEXCEPT ( 'Email Message', 'Email Message'[ParentId] )
                    ),
                    'Email Message'[MessageDate] > X && 'Email Message'[IncomingText]="FALSE"
                )
            VAR Y = MINX ( FilteredTable, 'Email Message'[MessageDate]  )
            VAR TimeDuration = DATEDIFF ( X, Y, SECOND )
            VAR Result = DIVIDE ( TimeDuration, 60 )
            RETURN
                Result
        ))
)

 

I had to make some ammendments, but Its calculating on the incoming email the time til the next outgoing email.

We have auto response on, so I need to find away to mark those and have it skip the auto response

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.