I have been working on this off and on since Mr. Shorty made the calvary call.
In its present form this is likely to be impractical, but perhaps it will inspire a thought in someone that will prove workable.
It seems to me that the Crew chart is working as desired, so what I am addressing is the Task chart.
I propose using a Gantt chart produced as follows.
1. Use Get & Transform to combine the person tables on Sheet 3 using the following code:
let
Source = Excel.CurrentWorkbook(),
#"Filtered Rows1" = Table.SelectRows(Source, each ([Name] <> "Query1")),
#"Expanded Content" = Table.ExpandTableColumn(#"Filtered Rows1", "Content", {"Time Slot #", "Task Code", "Start", "End", "Duration"}, {"Time Slot #", "Task Code", "Start", "End", "Duration"}),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Content",{{"Start", type time}, {"End", type time}, {"Duration", type duration}, {"Time Slot #", Int64.Type}, {"Task Code", type text}}),
#"Inserted Text After Delimiter" = Table.AddColumn(#"Changed Type", "Text After Delimiter", each Text.AfterDelimiter([Name], "_"), type text),
#"Removed Columns" = Table.RemoveColumns(#"Inserted Text After Delimiter",{"Name", "Time Slot #"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Text After Delimiter", "Name"}}),
#"Sorted Rows" = Table.Sort(#"Renamed Columns",{{"Task Code", Order.Ascending}, {"Start", Order.Ascending}}),
#"Removed Columns1" = Table.RemoveColumns(#"Sorted Rows",{"Duration"})
in
#"Removed Columns1"
2. From the query produced table (green/white) on the Query1 sheet use the following formula to fill cells H5:S11
Formula:
=AGGREGATE(15,6,(ROW(Query1[[Start]:[Start]])-ROW(Query1[#Headers]))/(Query1[[Task Code]:[Task Code]]=$F5)/((Query1[[Start]:[Start]]=H$3)+(Query1[[End]:[End]]=H$4)),1)
3. Use the following code to produce the Gantt chart in cells H16:S25
Formula:
=IFERROR(INDEX(Query1[[Name]:[Name]],IF(ISNUMBER(H5),H5,IF(COUNTIFS($H5:H5,INDEX($H5:H5,AGGREGATE(14,6,(COLUMN($H5:H5)-COLUMN($G5))/(ISNUMBER($H5:H5)),1)))<2,INDEX($H5:H5,AGGREGATE(14,6,(COLUMN($H5:H5)-COLUMN($G5))/(ISNUMBER($H5:H5)),1)),IF(COUNTIFS($H5:H5,INDEX($H5:H5,AGGREGATE(15,6,(COLUMN($H5:H5)-COLUMN($G5))/(ISNUMBER($H5:H5)),1)))<2,INDEX($H5:H5,AGGREGATE(15,6,(COLUMN($H5:H5)-COLUMN($G5))/(ISNUMBER($H5:H5)),1)),"")))),"")
4. Several conditional formatting rules are applied to the cells containing names as well as one for the blank cells.
Let us know if you have any questions.
Bookmarks