cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
adnankabina
Frequent Visitor

calculate hours BETWEEN TWO DATES

i have plan date coulmn 

 

PLANNED_PKUP_DTT                      ACTUAL_PKUP_DTT                          DIFFACT_PLANNED

10/12/2021 12:22:00 PM                10/13/2021 12:00:00 AM                    288

10/12/2021  4:16:00 PM                  10/12/2021 9:09:44 AM                      336

 

DIFFERENCE BETWEEN BOTH IN HOURS 

 

I USED THIS 

DIFFACT_PLANNED = DATEDIFF(IBdata[PLANNED_PKUP_DTT], IBdata[ACTUAL_PKUP_DTT], HOUR)*24
 
is it minutes ?
1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

hi @adnankabina 

 

Try this

 

 

Measure = ABS(DATEDIFF(SELECTEDVALUE('IBdata'[ACTUAL_PKUP_DTT]), SELECTEDVALUE('IBdata'[PLANNED_PKUP_DTT]), HOUR)) 

 

datedi.png

 

The ABS() function just returns the absolute value of the number, regardless of whether it's positive or negative.  You may have cases where Actual - Planner (or Planned - Actual) results in a negative number of hours.

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

1 REPLY 1
PhilipTreacy
Super User
Super User

hi @adnankabina 

 

Try this

 

 

Measure = ABS(DATEDIFF(SELECTEDVALUE('IBdata'[ACTUAL_PKUP_DTT]), SELECTEDVALUE('IBdata'[PLANNED_PKUP_DTT]), HOUR)) 

 

datedi.png

 

The ABS() function just returns the absolute value of the number, regardless of whether it's positive or negative.  You may have cases where Actual - Planner (or Planned - Actual) results in a negative number of hours.

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors