Forum Discussion
Min or Early Start Date
Hi good day, can anyone help me to create new table from my exisitng table but only column Job and Date, but date only the start date.
DESIRED OUTPUT
| Job | Group | Trade | Hours Per day | Date |
| QWE1111 | WEST | Mech | 13.86 | 2/9/2026 |
| QWE1111 | WEST | Mech | 13.86 | 2/10/2026 |
| QWE1111 | WEST | Mech | 13.86 | 2/11/2026 |
| ERT456546 | WEST | Mech | 16.05 | 3/5/2026 |
| ERT456546 | WEST | Mech | 16.05 | 3/6/2026 |
| HTYD | WEST | Mech | 3.87 | 3/6/2026 |
| HTYD | WEST | Mech | 3.87 | 3/7/2026 |
| HTYD | WEST | Mech | 3.87 | 3/8/2026 |
| UYRYT5463 | WEST | Mech | 14.41 | 2/10/2026 |
| UYRYT5463 | WEST | Mech | 14.41 | 2/11/2026 |
| UYRYT5463 | WEST | Mech | 14.41 | 2/12/2026 |
| UYRYT5463 | WEST | Mech | 14.41 | 2/13/2026 |
| UYRYT5463 | WEST | Mech | 14.41 | 2/14/2026 |
| IYRH1234 | WEST | Civil | 21.25 | 3/6/2026 |
| IYRH1234 | WEST | Civil | 21.25 | 3/7/2026 |
| IYRH1234 | WEST | Civil | 21.25 | 3/8/2026 |
| KYE67856 | WEST | Civil | 9.3 | 2/10/2026 |
| KYE67856 | WEST | Civil | 9.3 | 2/11/2026 |
| KYE67856 | WEST | Civil | 9.3 | 2/12/2026 |
| KYE67856 | WEST | Civil | 9.3 | 2/13/2026 |
| KYE67856 | WEST | Civil | 9.3 | 2/14/2026 |
| KYE67856 | WEST | Civil | 9.3 | 2/15/2026 |
| KYE67856 | WEST | Civil | 9.3 | 2/16/2026 |
| KYE67856 | WEST | Civil | 9.3 | 2/17/2026 |
| IKOnk867 | WEST | Civil | 6.16 | 2/7/2026 |
| IKOnk867 | WEST | Civil | 6.16 | 2/8/2026 |
| PKPOM0890 | WEST | Civil | 3.76 | 2/3/2026 |
| PKPOM0890 | WEST | Civil | 3.76 | 2/4/2026 |
| PKPOM0890 | WEST | Civil | 3.76 | 2/5/2026 |
hi AllanBerces ,
You can write a calculated table like:
Table = ADDCOLUMNS( VALUES(Table1[Job]), "Early Start", CALCULATE(MIN(Table1[Date])) )it works like:
If you have a big table, it would be more advisible to do it with Power Query, like:
M code:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ldMxC8IwEAXg/9K5pLlccklnLVSKqLUiQZxEUBRHf78RkRRuyWV5yzc83pHTqdodO0ivqqtjt59SrK+XWwpAFSiladrGaEPVuS7BoEUasu7GyTpylrgnpV1KbJyMU+b9FJdMph5eBn0pDBke4hinVBR5U6sssNmKPAi9EXoUepv9Ko49GLSZL+7v+/PrQBl2mRLuZXw2/hA78sER561CNn2BBpE2Io0ibUXaiTSJ9Pw8w+b1COS5JgW/Ty/Ts1tuh+1mrUOrOUflfxxl3Mr4f8TzBw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Job = _t, Group = _t, Trade = _t, #"Hours Per day" = _t, Date = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Job", type text}, {"Group", type text}, {"Trade", type text}, {"Hours Per day", type number}, {"Date", type date}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"Job"}, {{"EarlyStart", each List.Min([Date]), type nullable date}}) in #"Grouped Rows"HI,
This M code in Power Query works
let Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content], #"Grouped Rows" = Table.Group(Source, {"Job"}, {{"Count", each Table.Min(_,"Date")}}), #"Expanded Count" = Table.ExpandRecordColumn(#"Grouped Rows", "Count", {"Group", "Trade", "Hours Per day", "Date"}, {"Group", "Trade", "Hours Per day", "Date"}), #"Changed Type1" = Table.TransformColumnTypes(#"Expanded Count",{{"Job", type text}, {"Group", type text}, {"Trade", type text}, {"Hours Per day", type number}, {"Date", type date}}) in #"Changed Type1"Hope this helps.
In Power Query:
- Transform data → Power Query
- Select your table
- Keep only Job and Date
- Home ➜ Group By
- Group by: Job
- New column name: Start Date
- Operation: Min
However, if your table is big as you say I would suggest make these aggregations upstream like in SQL as it would be more effective in terms of performans and capacity usage.
6 Replies
- FreemanZ
Super User
hi AllanBerces ,
You can write a calculated table like:
Table = ADDCOLUMNS( VALUES(Table1[Job]), "Early Start", CALCULATE(MIN(Table1[Date])) )it works like:
- AllanBerces
Post Prodigy
Hi FreemanZ cengizhanarslan Ashish_Mathur thnak you very much for the reply work all good.
- Ashish_Mathur
Super User
You are welcome.
- FreemanZ
Super User
If you have a big table, it would be more advisible to do it with Power Query, like:
M code:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ldMxC8IwEAXg/9K5pLlccklnLVSKqLUiQZxEUBRHf78RkRRuyWV5yzc83pHTqdodO0ivqqtjt59SrK+XWwpAFSiladrGaEPVuS7BoEUasu7GyTpylrgnpV1KbJyMU+b9FJdMph5eBn0pDBke4hinVBR5U6sssNmKPAi9EXoUepv9Ko49GLSZL+7v+/PrQBl2mRLuZXw2/hA78sER561CNn2BBpE2Io0ibUXaiTSJ9Pw8w+b1COS5JgW/Ty/Ts1tuh+1mrUOrOUflfxxl3Mr4f8TzBw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Job = _t, Group = _t, Trade = _t, #"Hours Per day" = _t, Date = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Job", type text}, {"Group", type text}, {"Trade", type text}, {"Hours Per day", type number}, {"Date", type date}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"Job"}, {{"EarlyStart", each List.Min([Date]), type nullable date}}) in #"Grouped Rows"
- Ashish_Mathur
Super User
HI,
This M code in Power Query works
let Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content], #"Grouped Rows" = Table.Group(Source, {"Job"}, {{"Count", each Table.Min(_,"Date")}}), #"Expanded Count" = Table.ExpandRecordColumn(#"Grouped Rows", "Count", {"Group", "Trade", "Hours Per day", "Date"}, {"Group", "Trade", "Hours Per day", "Date"}), #"Changed Type1" = Table.TransformColumnTypes(#"Expanded Count",{{"Job", type text}, {"Group", type text}, {"Trade", type text}, {"Hours Per day", type number}, {"Date", type date}}) in #"Changed Type1"Hope this helps.
- cengizhanarslan
Super User
In Power Query:
- Transform data → Power Query
- Select your table
- Keep only Job and Date
- Home ➜ Group By
- Group by: Job
- New column name: Start Date
- Operation: Min
However, if your table is big as you say I would suggest make these aggregations upstream like in SQL as it would be more effective in terms of performans and capacity usage.