Search code examples
excelpowerbipowerquerypowerbi-desktopm

Power query - Convert hours and minutes in text format to duration format


I have a column that consists time data in hours and minutes, but it is in text format and I need to convert it to duration format in order to measure duration per month which I will use in my dashboard. Is there a syntax in M language?

enter image description here


Solution

  • If these are hours and minutes, then do the following.

    Add a column with text before delimiter:

    enter image description here

    Add a column with text after delimiter:

    enter image description here

    Change both to whole number type.

    Add a column as follows:

    #duration(0,[Text Before Delimiter],[Text After Delimiter],0)
    

    enter image description here

    enter image description here