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
MarcioL
Helper I
Helper I

DAX function HH:MM:SS to Decimal Format

Hi all!

 

I have this the folllowing time format in DAX (I do not have access to this column in Power BI Editor Query as I buit it in DAX).

 

I need a DAX function to add a column with this time in decimal format so I can use in a chart. I do not need AM and PM info as I have it in other column.

 

Much appreciated if you can assist.

 

hours.JPG

1 ACCEPTED SOLUTION
edhans
Super User
Super User

Use the FORMAT function to change data types. See this for the various formats you can use.

 

= FORMAT(Table1[Test],"General Number")

 

Note it will take AM/PM into account. So 3:32pm would be 0.647222 and 3:32am would be .147222



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

2 REPLIES 2
edhans
Super User
Super User

Use the FORMAT function to change data types. See this for the various formats you can use.

 

= FORMAT(Table1[Test],"General Number")

 

Note it will take AM/PM into account. So 3:32pm would be 0.647222 and 3:32am would be .147222



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

The input was useful.

 

The solution worked. But the generated column is in the format of text and not able to convert it to decimal number. 

I need to aggregate(Sum/average) which is not possible with text format.

 

Anyone please help me with this.

 

Thanks

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.