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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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