Power Query M Language-Convert Seconds to HH:MM:SS Format in Power BI
I got a scenario to convert the Seconds to HH:MM:SS in Power BI.
Step 1: Click on Edit Query and go to the query having seconds in the Column. Below is the screenshot of the Query. The table is “TimeTable” and Column having second Value is “Seconds”
Step 2: Go to Add Column Tab and create a custom column and write the M Script Code #duration(0,0,0,[Seconds])
Step 3: You will be getting values like the below screenshot in the new custom column.
Step 4: Close the Power Query and come to Data Tab in Power BI Desktop. You will now see the values in Time Column in Decimal Format.
Step 5: In Data Tab, Go to Modelling Tab and change the Data type of Time Column to “Time” and format to HH:MM: SS.
As per the above screenshot, You have successfully converted the Seconds to HH:MM: SS time format.
You can also change the Seconds to HH:MM: SS time format using DAX using simple mathematical calculation but that process is a little complex than the process mentioned above.
Please do comment if you find any error in this article or able to find any other way to achieve the same result.