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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
spandy34
Responsive Resident
Responsive Resident

Time field difference

I have the table below which includes two columns which are time fields.I want to add a column called Lost Time that subtracts the Actual_Duration_mins from the Comm_Duration_mins.  What will the DAX be for this please as I didnt know if it was different if I was using time fields.  

 

I am new to DAX so please bare with me

 

Thank you

@goncalogeraldes @tamerj1 

 

spandy34_0-1656410309420.png

 

1 ACCEPTED SOLUTION
goncalogeraldes
Super User
Super User

Hello there @spandy34 ! I figure that you are expecting a measure so here goes. 

 

Hope this works for you:

Lost Time =
DATEDIFF (
    SELECTEDVALUE ( 'Table'[Actual_Duration_mins] ),
    SELECTEDVALUE ( 'Table'[Comm_Duration_mins] ),
    MINUTE
)

 

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

View solution in original post

8 REPLIES 8
goncalogeraldes
Super User
Super User

Hello there @spandy34 ! I figure that you are expecting a measure so here goes. 

 

Hope this works for you:

Lost Time =
DATEDIFF (
    SELECTEDVALUE ( 'Table'[Actual_Duration_mins] ),
    SELECTEDVALUE ( 'Table'[Comm_Duration_mins] ),
    MINUTE
)

 

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

spandy34
Responsive Resident
Responsive Resident

Thank you very much

 

So I have the column below which is a which the format Time.  I want to create another column that is a decimal of that so for example if the column says 0.30 I want the new column to display 0.5 as a decimal of an hour.

 

Can you help with the DAX for that please.

 

THank you @goncalogeraldes 

 

spandy34_0-1656430675313.png

 

You can use the FORMAT() function:

New column =
FORMAT ( Table[Comm_Duration_mins], "General Number" )

 

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

What field type does my new column need to be as I get the following response as the new column is set to text?

 

spandy34_0-1656432060175.png

 

Just go:

New column =
VALUE( FORMAT ( Table[Comm_Duration_mins], "General Number" ) )

 

 Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

I have put this in and get the following:-

 

this is what I have put in the column

 

Comm_Duration_Decimal = VALUE(FORMAT ( Procurement_Data_2[Comm_Duration_mins], "General Number" ) )

 

spandy34_0-1656434064462.png

 

Try this then:

Comm_Duration_Decimal =
VALUE (
    FORMAT ( SELECTEDVALUE ( Procurement_Data_2[Comm_Duration_mins] ), "0.00" )
)
spandy34
Responsive Resident
Responsive Resident

I have done that and get an error "Cannot convert value '' of type Text to type Number."

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (27)