简体   繁体   中英

Power BI convert both HH:MM:SS format and decimal duration format to MM:SS format

PLease review the screenshot.

在此处输入图片说明

The column contains both HH:MM:SS format and decimal duration in hours format with extra leading zeros. They are both in Text format.

How to covert them to MM:SS format? Like for example 01:28:10 should be 88:10

I'm quite confused by how to achieve that by using DAX.

I have tried multiple possible solutions but none worked.

You may use the following function to only convert the format if it is in HH:MM:SS:

New Format = IF(len(Sheet1[ACD Time])=8,
            FORMAT(VALUE(LEFT(Sheet1[ACD Time],2))*60 + VALUE(MID(Sheet1[ACD Time],4,2)),"General Number")&":"&RIGHT(Sheet1[ACD Time],2),
                Sheet1[ACD Time])

Reference:

Format function https://dax.guide/format/

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM