<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Show Task on Table Based on Selected Week in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-Task-on-Table-Based-on-Selected-Week/m-p/4421219#M175528</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="823004" data-lia-user-login="KJChin" class="lia-mention lia-mention-user"&gt;KJChin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I used the following example data:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;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()
    )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;To establish a relationship between a calculated column and a date table:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To create a TaskCount measure:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;We need to make sure that the filter correctly covers all tasks and is dynamically associated with the selected week.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;TaskCount = 
CALCULATE(
    COUNTROWS(Project),
    FILTER(
        Project,
        NOT(ISBLANK(Project[ReferenceDate])) &amp;amp;&amp;amp;
        Project[ReferenceDate] &amp;gt;= MIN(Calendar[Date]) &amp;amp;&amp;amp;
        Project[ReferenceDate] &amp;lt;= MAX(Calendar[Date])
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;Here are the results:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;Jianpeng &lt;/SPAN&gt;&lt;SPAN&gt;Li&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;If this post &lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Feb 2025 06:28:04 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2025-02-21T06:28:04Z</dc:date>
    <item>
      <title>Show Task on Table Based on Selected Week</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-Task-on-Table-Based-on-Selected-Week/m-p/4419924#M175491</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically I have a project table, with structure like below:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Task&lt;/TD&gt;&lt;TD&gt;Created Date&lt;/TD&gt;&lt;TD&gt;Start Date&lt;/TD&gt;&lt;TD&gt;Closed Date&lt;/TD&gt;&lt;TD&gt;Target Date&lt;/TD&gt;&lt;TD&gt;Status&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;MM/DD/YYYY&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;TD&gt;Not Started&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;MM/DD/YYYY&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;TD&gt;On Hold&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;MM/DD/YYYY&lt;/TD&gt;&lt;TD&gt;MM/DD/YYYY&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;TD&gt;MM/DD/YYYY&lt;/TD&gt;&lt;TD&gt;In Progress&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;MM/DD/YYYY&lt;/TD&gt;&lt;TD&gt;MM/DD/YYYY&lt;/TD&gt;&lt;TD&gt;MM/DD/YYYY&lt;/TD&gt;&lt;TD&gt;MM/DD/YYYY&lt;/TD&gt;&lt;TD&gt;Closed&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;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).&lt;BR /&gt;&lt;BR /&gt;The issue that I encounter is that, the visual table will show almost every task because of&amp;nbsp;this relationship.&lt;BR /&gt;&lt;BR /&gt;So I try to use kinda 'cheatsheet' way by creating a calculated column at the project table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ReferenceDate =
VAR TaskStatus = Project[Status]
RETURN
    SWITCH (
        TRUE(),
        TaskStatus IN { "Not Started", "In Progress", "On Hold" }, Today(),
        TaskStatus = "Closed", WorkItems[Closed Date],
        BLANK()
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;When I select current week, yup, the task that match the condition did appear. Yet, when other week is selected, it will be blank.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Is there anyone ever encounter this before or have experience with it when develop gantt chart? How you overcome it?&lt;BR /&gt;&lt;BR /&gt;Any guidance will be helpful.&amp;nbsp;Thanks in advance.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2025 14:39:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-Task-on-Table-Based-on-Selected-Week/m-p/4419924#M175491</guid>
      <dc:creator>KJChin</dc:creator>
      <dc:date>2025-02-20T14:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: Show Task on Table Based on Selected Week</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-Task-on-Table-Based-on-Selected-Week/m-p/4421219#M175528</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="823004" data-lia-user-login="KJChin" class="lia-mention lia-mention-user"&gt;KJChin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I used the following example data:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;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()
    )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;To establish a relationship between a calculated column and a date table:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To create a TaskCount measure:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;We need to make sure that the filter correctly covers all tasks and is dynamically associated with the selected week.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;TaskCount = 
CALCULATE(
    COUNTROWS(Project),
    FILTER(
        Project,
        NOT(ISBLANK(Project[ReferenceDate])) &amp;amp;&amp;amp;
        Project[ReferenceDate] &amp;gt;= MIN(Calendar[Date]) &amp;amp;&amp;amp;
        Project[ReferenceDate] &amp;lt;= MAX(Calendar[Date])
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;Here are the results:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;Jianpeng &lt;/SPAN&gt;&lt;SPAN&gt;Li&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;If this post &lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 06:28:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-Task-on-Table-Based-on-Selected-Week/m-p/4421219#M175528</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-02-21T06:28:04Z</dc:date>
    </item>
  </channel>
</rss>

