Forum Discussion
Show Task on Table Based on Selected Week
- Anonymous1 year ago
Hi, KJChin
We need to make sure that the logic of the ReferenceDate covers all status tasks, and use Start Date instead of Today() for tasks that are not started, in progress, and paused. Using the Today() function restricts the task to be displayed only in the current week, and not for other weeks.
I used the following example data:
Create a new calculated column: Create a new calculated column in the Project table, ReferenceDate, which is used to determine which date to use as the reference date based on the status of the task.
ReferenceDate = VAR TaskStatus = Project[Status] RETURN SWITCH ( TRUE(), TaskStatus IN { "Not Started", "On Hold" }, Project[Created Date], TaskStatus = "In Progress", Project[Start Date], TaskStatus = "Closed", Project[Closed Date], BLANK() )To establish a relationship between a calculated column and a date table:
To create a TaskCount measure:
We need to make sure that the filter correctly covers all tasks and is dynamically associated with the selected week.TaskCount = CALCULATE( COUNTROWS(Project), FILTER( Project, NOT(ISBLANK(Project[ReferenceDate])) && Project[ReferenceDate] >= MIN(Calendar[Date]) && Project[ReferenceDate] <= MAX(Calendar[Date]) ) )Here are the results:
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, KJChin
We need to make sure that the logic of the ReferenceDate covers all status tasks, and use Start Date instead of Today() for tasks that are not started, in progress, and paused. Using the Today() function restricts the task to be displayed only in the current week, and not for other weeks.
I used the following example data:
Create a new calculated column: Create a new calculated column in the Project table, ReferenceDate, which is used to determine which date to use as the reference date based on the status of the task.
ReferenceDate =
VAR TaskStatus = Project[Status]
RETURN
SWITCH (
TRUE(),
TaskStatus IN { "Not Started", "On Hold" }, Project[Created Date],
TaskStatus = "In Progress", Project[Start Date],
TaskStatus = "Closed", Project[Closed Date],
BLANK()
)
To establish a relationship between a calculated column and a date table:
To create a TaskCount measure:
We need to make sure that the filter correctly covers all tasks and is dynamically associated with the selected week.
TaskCount =
CALCULATE(
COUNTROWS(Project),
FILTER(
Project,
NOT(ISBLANK(Project[ReferenceDate])) &&
Project[ReferenceDate] >= MIN(Calendar[Date]) &&
Project[ReferenceDate] <= MAX(Calendar[Date])
)
)
Here are the results:
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.