Power Query – Getting the Min Value repeated for all rows in my table
I was working on a side project, looking to track how I had been training in Strava (Yes, I am a M.A.M.I.L. for anyone who has been to my presentations would have seen the picture!)
What I was looking to do was to get the starting time of my event repeated on every row, which would then allow me to calculate how many minutes I had been exercising for, regardless of my start time.
I did it by doing the following:
-
I was inside Power Query, I then clicked on Add Column, then Custom Column
-
Below is the syntax, which I put into my Custom Column
-
List.Min(#"Renamed Columns3"[Time])
-
-
What I am doing with the above code is I am using the List.Min Power Query Function
- This expects a table to work.
- In my example I used my previous step name #”Renamed Columns3″ (which is a table)
- And then I put in the column that I wanted to get this Minimum value for, which was called [Time]
- Which then resulted in me getting the minimum time repeated on all the rows.
I could simply change the List.Min to List.Max if I wanted to get the Max value repeated.
Thanks for reading, and if you have any comments or suggestions please leave them in the section below.