Critical Path in Gantt Chart
What is Critical Path?
How Does It Work?
Displaying the Critical Path in a Gantt Chart in Power BI
Step 1: Create Custom Function in Power Query
(TaskTable as table) as list =>
let
// task with last End Date
MaxEndTask = Table.Max(TaskTable, "End Date"),
FinalTask = MaxEndTask[Task Name],
// Predecessors tasks
GetAllPredecessors = (targets as list, found as list) =>
let
step = Table.SelectRows(TaskTable, each List.Contains(targets, [Connect To]) and not List.Contains(found, [Task Name])),
newTasks = step[Task Name],
allFound = List.Union({found, newTasks}),
next = if List.IsEmpty(newTasks) then allFound else @GetAllPredecessors(newTasks, allFound)
in
next,
// list of tasks on critical path
Result = List.Distinct(List.Combine({{FinalTask}, GetAllPredecessors({FinalTask}, {})}))
in
Result
Step 2: Display Critical Path in Gantt Chart



Last updated
Was this helpful?