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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
mehul_sharma77
Regular Visitor

Calculate idle time between to calls

How to calculate idle time between to calls
an hour ago

Hello Team,

 

I want to calculate the idle time between 2 consecutive calls callusing Dax measure may be Dax Calculated column.
Please help 

The sample table is given below 

mehul_sharma77_0-1728560904550.png

 

 

Thanks 
Reply

Hello 

Thanks for your response, we are looking ideal time between 2 completed call 

like 

Start date time for current call - end call of previous call 
but the numbers shared in the snapshot by you are completely different. Please correct me if I am wrong 

mehul_sharma77_1-1728560921767.png

 

After running your Dax I got the following error. though I using best in class system configuration 

mehul_sharma77_2-1728560921766.png

 

Please HELP!!!!!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for the reply from @Greg_Deckler , please allow me to provide another insight.
Hi @mehul_sharma77 ,

First create an index column.

How to Add Index Column in Power BI (DAX) - Zebra BI

 

Then use the following DAX to create the idle time calculated column.

IdleTime = 
 VAR endCall =
    MAXX (
        FILTER ( 'Call', 'Call'[Index] = EARLIER ( 'Call'[Index] ) - 1 ),
        'Call'[CallEndDateTime]
    ) //end date of previous call 

VAR currentCall = 'Call'[CallStartDateTime] //Start date time for current call
RETURN
    DATEDIFF ( endCall, currentCall, SECOND ) //Displays the difference between two dates in seconds.


IdleTime column displays the difference (in seconds) between the start date of the current call and the end date of the previous call

vdengllimsft_0-1728900485286.png

 

Please see the attached pbix for reference.

Best Regards,
Dengliang Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thanks for the reply from @Greg_Deckler , please allow me to provide another insight.
Hi @mehul_sharma77 ,

First create an index column.

How to Add Index Column in Power BI (DAX) - Zebra BI

 

Then use the following DAX to create the idle time calculated column.

IdleTime = 
 VAR endCall =
    MAXX (
        FILTER ( 'Call', 'Call'[Index] = EARLIER ( 'Call'[Index] ) - 1 ),
        'Call'[CallEndDateTime]
    ) //end date of previous call 

VAR currentCall = 'Call'[CallStartDateTime] //Start date time for current call
RETURN
    DATEDIFF ( endCall, currentCall, SECOND ) //Displays the difference between two dates in seconds.


IdleTime column displays the difference (in seconds) between the start date of the current call and the end date of the previous call

vdengllimsft_0-1728900485286.png

 

Please see the attached pbix for reference.

Best Regards,
Dengliang Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Greg_Deckler
Community Champion
Community Champion

@mehul_sharma77 See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395....
The basic pattern is:
Column = 
  VAR __Current = [Value]
  VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])

  VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
RETURN
 ( __Current - __Previous ) * 1.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors