Forum Discussion

tomshaw83's avatar
tomshaw83
Helper I
5 years ago
Solved

Using a function to tranform similar data tables

Hi there,   I'm looking for some data transformation help. I am importing a PDF into power query which has around 50 tables in it. These 50 tables are set out in 8 different formats. I am lookin...
  • PhilipTreacy's avatar
    PhilipTreacy
    5 years ago

    tomshaw83 

    Hi Tom,

    You haven't provided any of your  queries so I hope I'm correctly understanding what you are trying to, it sounds like one of the things you are creating is a column with the total seconds from the times in the Time column?

     

    If so you can create a custom column and use this formula to convert times that have a minute component.

     

    = Table.AddColumn(PreviousStepname, "TotalSeconds", each Duration.TotalSeconds(Duration.FromText(Text.Insert([Time],0,"00:"))))

     

     To convert times without a minute component use this

     

    = Table.AddColumn(PreviousStepName, "TotalSeconds", each Duration.TotalSeconds(Duration.FromText(Text.Insert([Time],0,"00:00:"))))

     

     

    So for this there isn't any need to write your own function(s).  If you can supply your queries and explain the other things you are trying to do that you think a function might be needed, I can check to see if a custom function would make things easier, or if there's a way to achieve the result similar to above.

    Regards

    Phil


    If I answered your question please mark my post as the solution.
    If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.