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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
RnVssR
Regular Visitor

Format text to time format

Hi,

 I am using the following formula to calculate the duration that operators spent on IT tickets:

-------------------------------------------------------------

TijdBesteed =
VAR TotalTime = IF(ISBLANK(SUMX(RELATEDTABLE(OperationsActivityTimeRegistrations), OperationsActivityTimeRegistrations[timeSpent_inSeconds])), 0, SUMX(RELATEDTABLE((OperationsActivityTimeRegistrations)), OperationsActivityTimeRegistrations[timeSpent_inSeconds]))

VAR Uren = INT(TotalTime / 3600)
VAR Minuten = INT(MOD(TotalTime, 3600) / 60)
RETURN
    FORMAT(Uren, "00") & ":" & FORMAT(Minuten, "00")
-------------------------------------------------------------
 
I get the correct result. But one of my dashboard users, exports the data to excel to do some analytics. He is doing some caclulation on the duration(TijdBesteed) column, but it's failing because it is in text format. When i want to change the format in Power BI to a timevalue, i get the error(translatef from dutch): Cannot convert the value 30:00 of type Text to type Date.

How do i solve this?
1 ACCEPTED SOLUTION

Hi thank you. I have found another solution, where i convert seconds to time duration using the query editor. Found the answer on this page: https://community.fabric.microsoft.com/t5/Desktop/How-to-convert-seconds-to-hh-mm-ss/m-p/310816#M137...

View solution in original post

2 REPLIES 2
ryan_mayu
Super User
Super User

@RnVssR 

currently the output is Text. you need to use date or time function to make the output be datetime type.

TIME function (DAX) - DAX | Microsoft Learn





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi thank you. I have found another solution, where i convert seconds to time duration using the query editor. Found the answer on this page: https://community.fabric.microsoft.com/t5/Desktop/How-to-convert-seconds-to-hh-mm-ss/m-p/310816#M137...

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors