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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
KJChin
Frequent Visitor

Show Task on Table Based on Selected Week

Hi, 

I am working on building table that show all tasks with Status "Not Start", "On Hold", "In Progress" and closed task (by Closed Date) based on selected week. 

 

Basically I have a project table, with structure like below:

TaskCreated DateStart DateClosed DateTarget DateStatus
AMM/DD/YYYY---Not Started
BMM/DD/YYYY---On Hold
CMM/DD/YYYYMM/DD/YYYY-MM/DD/YYYYIn Progress
DMM/DD/YYYYMM/DD/YYYYMM/DD/YYYYMM/DD/YYYYClosed


And I created a Calendar table, with column Date (extracted from Min(Created Date) and Max(Target Date)) and column YearWeek (WW'YY). And I connect it (column Date) to project table (column Created Date).

The issue that I encounter is that, the visual table will show almost every task because of this relationship.

So I try to use kinda 'cheatsheet' way by creating a calculated column at the project table:

 

ReferenceDate =
VAR TaskStatus = Project[Status]
RETURN
    SWITCH (
        TRUE(),
        TaskStatus IN { "Not Started", "In Progress", "On Hold" }, Today(),
        TaskStatus = "Closed", WorkItems[Closed Date],
        BLANK()
    )

 


When I select current week, yup, the task that match the condition did appear. Yet, when other week is selected, it will be blank. 

Is there anyone ever encounter this before or have experience with it when develop gantt chart? How you overcome it?

Any guidance will be helpful. Thanks in advance. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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:

vjianpengmsft_0-1740119020311.png

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:

vjianpengmsft_1-1740119093238.png

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:

vjianpengmsft_2-1740119214189.png

 

 

 

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.

 

 

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

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:

vjianpengmsft_0-1740119020311.png

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:

vjianpengmsft_1-1740119093238.png

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:

vjianpengmsft_2-1740119214189.png

 

 

 

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.

 

 

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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