<?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: Get accumulated pending tasks in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-accumulated-pending-tasks/m-p/2430137#M64652</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;, thank you so much for your answer. helped me a lot. I used only the first part of the code with some adjustments and seems that it did the trick:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Pending =
    CALCULATE (
        DISTINCTCOUNT ( 'demand'[id] ),
        FILTER (
            'demand',
            'demand'[opening date] &amp;lt;= MAX( 'Calendar'[Date] )
                &amp;amp;&amp;amp; (
                    'demand'[closing date] &amp;gt; MAX( 'Calendar'[Date] )
                        || ISBLANK ( 'demand'[closing date] )
                )
        )
    )&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 31 Mar 2022 16:55:34 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-03-31T16:55:34Z</dc:date>
    <item>
      <title>Get accumulated pending tasks</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-accumulated-pending-tasks/m-p/2422221#M64216</link>
      <description>&lt;P&gt;Hi.&lt;BR /&gt;I have the following example table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;id&lt;/TD&gt;&lt;TD&gt;opening date&lt;/TD&gt;&lt;TD&gt;closing date&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;01/01/2021&lt;/TD&gt;&lt;TD&gt;01/02/2021&lt;/TD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t;12&lt;/TD&gt;&lt;TD&gt;01/02/2021&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;TD&gt;01/02/2021&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;TD&gt;01/02/2021&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;01/02/2021&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;16&lt;/TD&gt;&lt;TD&gt;01/02/2021&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;17&lt;/TD&gt;&lt;TD&gt;01/03/2021&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;18&lt;/TD&gt;&lt;TD&gt;01/03/2021&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;19&lt;/TD&gt;&lt;TD&gt;01/03/2021&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;01/03/2021&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each row of the table is a task (demand) that has been generated for someone. The objective is to create a histogram that shows the amount of accumulated open demands. An open demand is one that does not have an closing date, or whose closing date is later than the month bar in the histogram.&amp;nbsp;The result should be something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Note that 8 demands were generated in January, 8 in February and 4 in March,&amp;nbsp;but 4 were closed in February.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was helped before and came up to this solution, but it only works for 2021 dates. If I use 2022 data, the calculation doesn't work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Measure =
VAR _filter =
    FILTER (
        ALL ( 'Calendar' ),
        'Calendar'[Year] &amp;lt;= MAX ( 'Calendar'[Year] )
            &amp;amp;&amp;amp; 'Calendar'[Month] &amp;lt;= MAX ( 'Calendar'[Month] )
    )
VAR _opening =
    CALCULATE (
        COUNT ( demand[opening date] ),
        TREATAS ( VALUES ( 'Calendar'[Date] ), demand[opening date] )
    )
VAR _closing =
    CALCULATE (
        COUNT ( demand[closing date] ),
        TREATAS ( VALUES ( 'Calendar'[Date] ), demand[closing date] )
    )
VAR _accumulatedOpening =
    CALCULATE (
        CALCULATE (
            COUNT ( demand[opening date] ),
            TREATAS ( VALUES ( 'Calendar'[Date] ), demand[opening date] )
        ),
        _filter,
        demand
    )
VAR _accumulatedClosing =
    CALCULATE (
        CALCULATE (
            COUNT ( demand[closing date] ),
            TREATAS ( VALUES ( 'Calendar'[Date] ), demand[closing date] )
        ),
        _filter,
        demand
    )
VAR _diff = _accumulatedOpening - _accumulatedClosing
RETURN
    IF ( _opening &amp;lt;&amp;gt; BLANK () || _closing &amp;lt;&amp;gt; BLANK (), _diff )&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Mar 2022 17:47:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-accumulated-pending-tasks/m-p/2422221#M64216</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-28T17:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: Get accumulated pending tasks</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-accumulated-pending-tasks/m-p/2422277#M64221</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;why are using TREATAS? Aren't there a relationship between your table and the Calendar table?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 18:39:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-accumulated-pending-tasks/m-p/2422277#M64221</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-28T18:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: Get accumulated pending tasks</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-accumulated-pending-tasks/m-p/2422284#M64222</link>
      <description>&lt;P&gt;sincerely, I do not know. I had some problems with this formula and couldn't fully understand it.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 18:44:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-accumulated-pending-tasks/m-p/2422284#M64222</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-28T18:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Get accumulated pending tasks</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-accumulated-pending-tasks/m-p/2422285#M64223</link>
      <description>&lt;P&gt;Can you share a screenshot of your data model with the relationships?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 18:46:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-accumulated-pending-tasks/m-p/2422285#M64223</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-28T18:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: Get accumulated pending tasks</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-accumulated-pending-tasks/m-p/2422302#M64224</link>
      <description>&lt;P&gt;actually there is no relationship between the two tables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the DAX formula is this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Atividades pendentes = 
VAR _filter =
    FILTER (
        ALL ( 'Calendário' ),
        'Calendário'[Ano] &amp;lt;= MAX ( 'Calendário'[Ano] )
            &amp;amp;&amp;amp; 'Calendário'[Mês Num] &amp;lt;= MAX ( 'Calendário'[Mês Num])
    )
VAR _opening =
    CALCULATE (
        COUNT ( df[data_inicio] ),
        TREATAS ( VALUES ( 'Calendário'[Date] ), df[data_inicio] )
    )
VAR _closing =
    CALCULATE (
        COUNT ( df[data_conclusao] ),
        TREATAS ( VALUES ( 'Calendário'[Date] ), df[data_conclusao])
    )
VAR _accumulatedOpening =
    CALCULATE (
        CALCULATE (
            COUNT ( df[data_inicio] ),
            TREATAS ( VALUES ( 'Calendário'[Date] ), df[data_inicio])
        ),
        _filter,
        df
    )
VAR _accumulatedClosing =
    CALCULATE (
        CALCULATE (
            COUNT ( df[data_conclusao] ),
            TREATAS ( VALUES ( 'Calendário'[Date] ), df[data_conclusao] )
        ),
        _filter,
        df
    )
VAR _diff = _accumulatedOpening - _accumulatedClosing
RETURN
    IF ( _opening &amp;lt;&amp;gt; BLANK () || _closing &amp;lt;&amp;gt; BLANK (), _diff )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 18:54:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-accumulated-pending-tasks/m-p/2422302#M64224</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-28T18:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Get accumulated pending tasks</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-accumulated-pending-tasks/m-p/2428844#M64600</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I created a sample pbix file(&lt;STRONG&gt;&lt;I&gt;see attachment&lt;/I&gt;&lt;/STRONG&gt;), please check whether that is what you want.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1. Update the formula of your measure as below&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR _opening =
    CALCULATE (
        DISTINCTCOUNT ( 'demand'[id] ),
        FILTER (
            'demand',
            'demand'[opening date] &amp;lt;= SELECTEDVALUE ( 'Calendar'[Date] )
                &amp;amp;&amp;amp; (
                    'demand'[closing date] &amp;gt; SELECTEDVALUE ( 'Calendar'[Date] )
                        || ISBLANK ( 'demand'[closing date] )
                )
        )
    )
VAR _closing =
    CALCULATE (
        DISTINCTCOUNT ( 'demand'[id] ),
        FILTER (
            'demand',
            NOT ( ISBLANK ( 'demand'[closing date] ) )
                &amp;amp;&amp;amp; 'demand'[closing date] &amp;lt;= SELECTEDVALUE ( 'Calendar'[Date] )
        )
    )
RETURN
  _opening - _closing&lt;/LI-CODE&gt;
&lt;P&gt;2. Create a column chart as below screenshot (&lt;STRONG&gt;Axis:&lt;/STRONG&gt; Date field of Calendar table&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;Values:&lt;/STRONG&gt; [Measure])&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In addition, you can refer the following links to get it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/Count-open-tickets-over-previous-time-periods/m-p/2040221/highlight/true" target="_self"&gt;&lt;SPAN&gt;Count open tickets over previous time periods&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DuWpwZMfP5ns&amp;amp;data=04%7C01%7Cv-yiruan%40microsoft.com%7C0de4b8a2ee4b441f331108da116d0de4%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637841457487411954%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;amp;sdata=bAL1%2FiBr7feqPh%2BYleEYMdHCJ5fGiRrGu1sGe2ueEvM%3D&amp;amp;reserved=0" target="_self"&gt;Total Number Of Staff Over Time - Power BI Insights&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.mssqltips.com%2Fsqlservertip%2F5418%2Fcalculating-employee-attrition-with-dax-part-2%2F&amp;amp;data=04%7C01%7Cv-yiruan%40microsoft.com%7C0de4b8a2ee4b441f331108da116d0de4%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637841457487411954%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;amp;sdata=Jqp4VGX%2B1%2FNGEGJ1QBi%2FdFXdWC7KSIvjRDuSM9isjCU%3D&amp;amp;reserved=0" target="_self"&gt;Calculating Employee Attrition with DAX&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 07:51:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-accumulated-pending-tasks/m-p/2428844#M64600</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-31T07:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: Get accumulated pending tasks</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-accumulated-pending-tasks/m-p/2430137#M64652</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;, thank you so much for your answer. helped me a lot. I used only the first part of the code with some adjustments and seems that it did the trick:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Pending =
    CALCULATE (
        DISTINCTCOUNT ( 'demand'[id] ),
        FILTER (
            'demand',
            'demand'[opening date] &amp;lt;= MAX( 'Calendar'[Date] )
                &amp;amp;&amp;amp; (
                    'demand'[closing date] &amp;gt; MAX( 'Calendar'[Date] )
                        || ISBLANK ( 'demand'[closing date] )
                )
        )
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 31 Mar 2022 16:55:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-accumulated-pending-tasks/m-p/2430137#M64652</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-31T16:55:34Z</dc:date>
    </item>
  </channel>
</rss>

