Forum Discussion
Using a function to tranform similar data tables
- 5 years ago
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.
PhilipTreacy Thank you, the time transformation was the thing taking the most steps, which with your code as removed all the unecessary ones, so it looks like at present I don't need a function.
Regards
Tom