Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Average time between emails

Please advice how to get time from previous email. I have table bellow: email_ID customer received 1 alfa 1.1.2024 12:00 2 alfa 1.1.2024 13:00 3 beta 1.1.2024 13:15 4 alfa ...
  • Irwan's avatar
    1 year ago

    hello Anonymous 

     

    please check if this accomodate your need.

     

    1. create a new measure for calculating 'Get Time from Previous Email'

    Get Time from Previous Email = 
    var _ID = SELECTEDVALUE('Table'[email_ID])
    Return
    MAXX(
        FILTER(
            ALL('Table'),
            'Table'[email_ID]<_ID
        ),
        'Table'[received]
    )

    2. create a new measure for calculating 'Time Difference' since you want to see the average time

    Time Difference = 
    var _Received = SELECTEDVALUE('Table'[received])
    Return
    DATEDIFF('Table'[Get Time from Previous Email],_Received,MINUTE)

    3. create a new measure for calculating 'Average'

    Average = AVERAGEX('Table',[Time Duration])

    4. to get average time for each customer, create a slicer with customer as the value.

     

    Hope this will help.

    Thank you.