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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
walnei
Helper III
Helper III

DIFFERENCE BETWEEN DAYS AND HOURS

Hello, can you help me?

I have two DATE / TIME columns.

Column A - DATE TIME BEGINNING

Column B - FINAL TIME DATE

example.

Column A - 10/12/2017 1:00 p.m.

Column B - 10/14/2017 1:30 PM

I would like a DAX formula or by PowerQuery to return the following.

Column B - Column A = 48h: 30m or 48:30.

I tried with datediff but it did not work.

Thank you

1 ACCEPTED SOLUTION
v-jiascu-msft
Employee
Employee

Hi @walnei,

 

Neither 48h: 30m nor 48:30 is a date/time format. It's a text format actually. You can format it like this:

HMformat =
VAR minutes =
    DATEDIFF ( [Column1], [Column2], MINUTE )
RETURN
    CONCATENATE ( CONCATENATE ( INT ( minutes / 60 ), ":" ), MOD ( minutes, 60 ) )

DIFFERENCE BETWEEN DAYS AND HOURS.jpg

 

 

 

 

 

 

Best Regards!

Dale

Community Support Team _ Dale
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

3 REPLIES 3
v-jiascu-msft
Employee
Employee

Hi @walnei,

 

Neither 48h: 30m nor 48:30 is a date/time format. It's a text format actually. You can format it like this:

HMformat =
VAR minutes =
    DATEDIFF ( [Column1], [Column2], MINUTE )
RETURN
    CONCATENATE ( CONCATENATE ( INT ( minutes / 60 ), ":" ), MOD ( minutes, 60 ) )

DIFFERENCE BETWEEN DAYS AND HOURS.jpg

 

 

 

 

 

 

Best Regards!

Dale

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

date diff should work.  Just format the new column as decimal numbers



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Anonymous
Not applicable

Datetime is stored as a decimal number where the Whole number portion represents the days since 1899.  The decimal portion referecens the percentage of a day.  I.e. midday is 0.5

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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