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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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