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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Jeyeline
Helper III
Helper III

How to calculate the difference between two dates with timeframes in a particular format

Hello All,

 

 I have to calculate the mean time to respond based on two fields, by calculating the difference between these fields
Reporting Date&Time: 18-01-2025 12:30:00 PM
Actual Date&Time: 19-01-2025 9:00:00 AM

However while using the difference functions i am not receiving the expected results.

Expectation is, calculating the difference in minutes. How that could be possible in DAX. Can anyone help on this

 

1 ACCEPTED SOLUTION
speedramps
Super User
Super User

Try this DAX measure ...

 

Duration = 
DATEDIFF(
    SELECTEDVALUE(yourdata[Reporting Date&Time]),
    SELECTEDVALUE(yourdata[Actual Date&Time]),
    MINUTE
)

  

Please click the [accept solution] and thumbs up button. Thank you

View solution in original post

4 REPLIES 4
Bibiano_Geraldo
Super User
Super User

Hi @Jeyeline ,

Assuming that your table model look like this:

Bibiano_Geraldo_0-1737369708159.png

 

You can achieve the desired result creating a new measure with this DAX:

Mean2 Time to Respond (Minutes) = 
DATEDIFF(SELECTEDVALUE('Table'[Reporting Date&Time]), SELECTEDVALUE('Table'[Actual Date&Time]), MINUTE)

Your result in the matrix will look like this:

Bibiano_Geraldo_1-1737369781187.png

If you want as calculated column, you can use this DAX:

Mean Time to Respond (Minutes) = 
DATEDIFF('Table'[Reporting Date&Time], 'Table'[Actual Date&Time], MINUTE)

And your result will look like this:

Bibiano_Geraldo_2-1737369864342.png

 

Is this post help you? Please consider to:

Accept as Solution!
Give a Kudo
Follow me on Linkedin

anmolmalviya05
Super User
Super User

Hi , Hope you are doing good.

Please try the below measure:

MeanTimeToRespond =
DATEDIFF(
'TableName'[Reporting Date&Time],
'TableName'[Actual Date&Time],
MINUTE
)

Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!

 

Let's Connect on LinkedIn: https://www.linkedin.com/in/anmol-malviya/?originalSubdomain=in

 

Subscribe my youtube channel for Microsoft Fabric and Power BI updates: https://www.youtube.com/@AnmolPowerBICorner



 

@Jeyeline

DivkLearner
Resolver I
Resolver I

Hello @Jeyeline 

 

we can use the following formula

DifferenceDate = DATEDIFF(Reporting Date&Time:,Actual Date&Time,MINUTE)
 
 
Best regards,
DivKlearner – A Bit Forward Daily
Join us as we explore and learn IT together.
Discover simplified IT learning on YouTube
 
 
speedramps
Super User
Super User

Try this DAX measure ...

 

Duration = 
DATEDIFF(
    SELECTEDVALUE(yourdata[Reporting Date&Time]),
    SELECTEDVALUE(yourdata[Actual Date&Time]),
    MINUTE
)

  

Please click the [accept solution] and thumbs up button. Thank you

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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