Forum Discussion
Anonymous
9 years agoNot applicable
formatting time value to hh:mm:ss
I hope I am posting this to the right location as I am developing a new report. Anyway, this is coming out of our telephone DB system and one column represented is Duration, which is an int column a...
- 9 years ago
Anonymous
Try a DAX as below.
fmtCol = RIGHT ( "0" & INT ( TableName[Duration] / 3600 ), 2 ) & ":" & RIGHT ( "0" & INT ( ( TableName[Duration] - INT (TableName[Duration] / 3600 ) * 3600 ) / 60 ), 2 ) & ":" & RIGHT ( "0" & MOD (TableName[Duration], 3600 ), 2 )Or deal with the format in query.
select Duration, convert(varchar(10),DATEADD(second,Duration,0),108) fmtSecs from t1
Eric_Zhang
9 years agoMicrosoft Employee
Anonymous
Try a DAX as below.
fmtCol =
RIGHT ( "0" & INT ( TableName[Duration] / 3600 ), 2 )
& ":"
& RIGHT (
"0"
& INT ( ( TableName[Duration] - INT (TableName[Duration] / 3600 ) * 3600 ) / 60 ),
2
)
& ":"
& RIGHT ( "0" & MOD (TableName[Duration], 3600 ), 2 )
Or deal with the format in query.
select Duration, convert(varchar(10),DATEADD(second,Duration,0),108) fmtSecs from t1
Anonymous
8 years agoNot applicable
Hi Eric_Zhang
I kinda stuck with the similar error when converting the seconds to duration (HH : MM : SS) format using the following query.
Select TimeinSeconds, from_unixtime(TimeinSeconds,"HH:mm:ss") as Duration From Tablename
When I execute the above query in Impala, I'm getting the result as expected and the same query when I use to load the data into Power BI, I'm getting this "Token Comma Expected" error. Can you help me with this, please?