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
Anonymous
Not applicable

Not able to convert hh:mm:ss value into decimal values

HI ,

 

my column data is in hh:mm:ss format for ex.

 

12:23:34

08:23:12

 

i want it to be converted into decimal value like for first value it should show me 12.23 hours

and second should show me 8.23 hours

 

Please suggest me some ways to convert it . I have tried all dax formulas best of my knowldege. i amanged to get it converted it into seconds. by=ut i require in this format

1 ACCEPTED SOLUTION
v-cherch-msft
Employee
Employee

Hi @Anonymous 

You may create a new column to get the value.For example:

Column 2 = HOUR([Column])+MINUTE([Column])/60+SECOND([Column])/60/60

a1.png

Regards,

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

9 REPLIES 9
Sridhar_Shekar
New Member

Sridhar_Shekar_1-1637760018738.png

My example :( I have Vehicle Hours in Seconds to convert that into hours & decimal time.

Trip Hours:

Trip Hrs = VAR hours =
ROUNDDOWN ( [VehicleHours] / 3600, 0 )
VAR minutes =
ROUNDDOWN ( MOD ( [VehicleHours], 3600 ) / 60, 0 )
VAR seconds =
INT ( MOD ( [VehicleHours], 60 ) )
RETURN
FORMAT(hours,"00") & ":"
& FORMAT(minutes, "00")
& ":"
& FORMAT(seconds, "00").
 
To Convert the time :hh:mm:ss into number
 
Column = 'DetailDailyUtilisation Aug-21'[VehicleHours]/86400*24
 

 

v-cherch-msft
Employee
Employee

Hi @Anonymous 

You may create a new column to get the value.For example:

Column 2 = HOUR([Column])+MINUTE([Column])/60+SECOND([Column])/60/60

a1.png

Regards,

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

Hi Preetam,

 

Did you try converting the data type from the modeling field? see below my Before and After outputs

 

Before:

Capture 4.PNG

Capture5.PNG

 After:

Capture 6.PNG

Capture 7.PNG

Anonymous
Not applicable

Hi,

 

My column which contains data in hh:mm:ss format resulted from substracting two other columns start time and end time  so it is a calculated column.Now ,suggest does this method still works ?

Anonymous
Not applicable

Please try these steps.

 

1. Change the data type of your calculated column to Decimal.

2. Create a new column using this formula : 

Decimal Duration = TimeConversion[Duration]*24
Duration.png

 

Anonymous
Not applicable

ok. I did not know what was your scenario.

 

May be this post helps you.

 

https://community.powerbi.com/t5/Desktop/How-to-convert-time-HH-MM-SS-into-integer/td-p/106617/page/...

 

Thanks,

Tejaswi

jthomson
Solution Sage
Solution Sage

Split it into three columns using : as a delimiter, then make a new column that's hours + (minutes/100)

Anonymous
Not applicable

Is there any nested dax formula that work?

 

Also why need to divide minutes by 100 not 60?

I don't know about a DAX solution, and I'm dividing by 100 as that's what'd give you the result you wanted

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.