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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

Average time between emails

Please advice how to get time from previous email.

I have table bellow:

email_IDcustomerreceived
1alfa1.1.2024 12:00
2alfa1.1.2024 13:00
3beta1.1.2024 13:15
4alfa2.1.2024 08:00
5beta

2.1.2024 10:15

6beta

3.1.2024 07:15


1. How to get the average time to receive emails?
2. How to get the average time to receive emails with active customer slicer? (for example: from alfa only)

Thank you in advance!
Jaroslav

 

1 ACCEPTED SOLUTION
Irwan
Super User
Super User

hello @Anonymous 

 

please check if this accomodate your need.

Irwan_0-1733525229871.png

 

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.

Irwan_1-1733525261398.png

 

Hope this will help.

Thank you.

View solution in original post

1 REPLY 1
Irwan
Super User
Super User

hello @Anonymous 

 

please check if this accomodate your need.

Irwan_0-1733525229871.png

 

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.

Irwan_1-1733525261398.png

 

Hope this will help.

Thank you.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.