Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dpblue
New Member

Project Task assessment calculation problem

For example, I have 3 tasks that all have an immediate preceding relationship,task2 start as task1 finished,
1 <- 2 <- 3
task1 has a scheduled start time of 1 and a scheduled completion time of 1, 2 has a scheduled start time of 1 and a scheduled completion time of 2, and so on.
Now the problem is, if due to 1, task 2 is not started, so the completion time is also delayed, in this case, the assessment criteria is only task 1 is not completed, the delay is 1 day, task 2, 3 is normal, the assessment is "actual completion time" - "planned completion time ", so the last column should be 1, are delayed by one day, but task 2, 3 is due to task 1 delay caused by, so to remove the 2 tasks of the delay to 0,how can i do this using Dax?

TaskIDPlanedStartPlanFinishActualStartActualFinishPredecessorDeLayActualDelay
11112 11
22233110
33344210
1 REPLY 1
technolog
Super User
Super User

To achieve this in DAX, you can create a calculated column for ActualDelay. Here's how you can do it:

First, you need to determine if the task's actual start time is delayed due to its predecessor. If the task's actual start time is greater than its planned start time and the predecessor's actual finish time is greater than the predecessor's planned finish time, then the task is delayed due to its predecessor.

Now, for the ActualDelay calculation:

If a task is delayed due to its predecessor, set ActualDelay to 0. Otherwise, calculate the delay as the difference between the actual finish time and the planned finish time.

Here's the DAX formula for the ActualDelay column:

ActualDelay =
VAR CurrentTaskID = Tasks[TaskID]
VAR PredecessorID = Tasks[Predecessor]
VAR PredecessorActualFinish = LOOKUPVALUE(Tasks[ActualFinish], Tasks[TaskID], PredecessorID)
VAR PredecessorPlanFinish = LOOKUPVALUE(Tasks[PlanFinish], Tasks[TaskID], PredecessorID)

RETURN
IF(
AND(
Tasks[ActualStart] > Tasks[PlanedStart],
PredecessorActualFinish > PredecessorPlanFinish
),
0,
Tasks[ActualFinish] - Tasks[PlanFinish]
)
In this formula, we're using the LOOKUPVALUE function to get the actual and planned finish times of the predecessor task. We then determine if the current task is delayed due to its predecessor. If it is, we set ActualDelay to 0. Otherwise, we calculate the delay as the difference between the actual and planned finish times.

I hope this helps! Let me know if you have any questions or need further clarification.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.