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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Steve_luck22
New Member

Problem Calculating Date Diff from Date formatted DD/MM/YYYY HH:MM

Hi Everyone, i have a problem that i just cant seem to solve and im certain there is a simple alternative out there. I have a column (Example below) that has a cell formatted DD/MM/YYYY Hours:Minutes and i am trying to create a counter that breaks the days left into a format below, i can do it easily on Excel but trying to convert it to Power BI is a struggle. 

 

I have used the Date Diff to calculate the difference in days, but i cant seem to bring it into one column? and include both hours, minutes and days. Any help would be greatly appreciated. 

 
Target Completion Date      Target Completion date in days & Hours

 

21/02/2023 08:15                 -1 Days 15 Hours 50 Minutes

2 REPLIES 2
Steve_luck22
New Member

Hi Mark, 

 

Data example and output below, i have achieved it on Excel with the following but struggling with the Power BI query. i basically want to compare the Target Completion Date with TODAY() or NOW() to get an output in a format below

 

=INT(J2-NOW())&" Days "&HOUR(MOD(J2-$N$1,1))&" Hours "&MINUTE(MOD(J2-$N$1,1))&" minutes "

 

Target Completion Date Target Completion Date in days
21/02/2023 08:15 -1 Days 15 Hours 16 minutes
21/02/2023 09:04 -1 Days 16 Hours 6 minutes
21/02/2023 07:54 -1 Days 14 Hours 56 minutes
21/02/2023 15:07 -1 Days 22 Hours 9 minutes

Greg_Deckler
Super User
Super User

@Steve_luck22 Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.