Forum Discussion

Magnus-CPH-DK's avatar
Magnus-CPH-DK
Helper II
3 years ago
Solved

Difference between two datetime values in format dd:hh:mm:ss

Hi there   I have two datetime columns:     Power Query recognizes the column data types as datetimes. However, I am not sure if the formatting (probably regional) causes problems. When I ...
  • serpiva64's avatar
    3 years ago

    Hi,

    i think your problem is Milliseconds which are in your datetime.

    You have to extract Text before delimiter in each column using . as delimiter

    (and if you prefer in the same step change type text to type datetime)

     = Table.TransformColumns(#"Changed Type", {{"Column1", each Text.BeforeDelimiter(Text.From(_, "it-IT"), "."), type datetime}})

    then you use your formula

    and it will be all right

    When you change finally the type you need to use Duration and not Datetime.

    If this post is useful to help you to solve your issue, consider giving the post a thumbs up and accepting it as a solution!

     

    p.s.: pay attention to the fact that you will not be able to use duration in your report (when you load your duration is converted to decimal). Refer to this in order to handle this problem

    https://community.powerbi.com/t5/Desktop/Duration-format/m-p/447543