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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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.


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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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