<?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: Measure that dynamically calculates date difference between consecutive rows in a group in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-that-dynamically-calculates-date-difference-between/m-p/2763798#M85753</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="438738" data-lia-user-login="anonymous3" class="lia-mention lia-mention-user"&gt;anonymous3&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I have created a simple sample, please refer to it to see if it helps you.&lt;/P&gt;
&lt;P&gt;Create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;_DaysSinceEndElapsed =
VAR _enddate =
    CALCULATE (
        MAX ( 'table'[enddate] ),
        FILTER (
            ALLSELECTED ( 'table' ),
            'table'[Group] = SELECTEDVALUE ( 'table'[Group] )
                &amp;amp;&amp;amp; 'table'[id] &amp;lt; SELECTEDVALUE ( 'table'[id] )
        )
    )
VAR _startdate =
    MAX ( 'table'[startdate] )
RETURN
    DATEDIFF ( _enddate, _startdate, DAY )
&lt;/LI-CODE&gt;
&lt;P&gt;Then put the id column into the slicer.&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;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If I have misunderstood your meaning, please provide more details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ Polly&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Sep 2022 08:50:27 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-09-13T08:50:27Z</dc:date>
    <item>
      <title>Measure that dynamically calculates date difference between consecutive rows in a group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-that-dynamically-calculates-date-difference-between/m-p/2762431#M85665</link>
      <description>&lt;P&gt;Hello, PowerBI community.&amp;nbsp;&lt;BR /&gt;I desperately need your help as this task is taking much more time than it would be worth spending on it.&lt;BR /&gt;&lt;BR /&gt;I need a measure that calculates date difference between EndDate and previous StartDate in days by Group column and dynamically recalculates when particular filters are applied:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;So far I tried something like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_DaysSinceEndElapsed = 
IF(
    SELECTEDVALUE(table[is_first_record_in_group])=True,
    BLANK(),
    DATEDIFF(
        CALCULATE(
            MAX([ExitDate]), 
            FILTER(
                ALL(table),
                table[Group] = MAX(table[Group]) &amp;amp;&amp;amp;
                table[id] &amp;lt; MAX(table[id])
            )
        ),
        SELECTEDVALUE(table[EndDate]),
        DAY
    )
)&lt;/LI-CODE&gt;&lt;P&gt;but it doesn't recalculate when I apply the filters.&lt;BR /&gt;&lt;BR /&gt;Please, help&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2022 16:13:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-that-dynamically-calculates-date-difference-between/m-p/2762431#M85665</guid>
      <dc:creator>anonymous3</dc:creator>
      <dc:date>2022-09-12T16:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: Measure that dynamically calculates date difference between consecutive rows in a group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-that-dynamically-calculates-date-difference-between/m-p/2762900#M85695</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="438738" data-lia-user-login="anonymous3" class="lia-mention lia-mention-user"&gt;anonymous3&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I was a little confused. In the first table, in a, the _dayssinceendelapsed value is 60 and 14? How to calculate to get the value ? And in the second table, which date was filtered so that&amp;nbsp; the result is 104? Could you pease provide more details?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ Polly&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 01:42:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-that-dynamically-calculates-date-difference-between/m-p/2762900#M85695</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-13T01:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: Measure that dynamically calculates date difference between consecutive rows in a group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-that-dynamically-calculates-date-difference-between/m-p/2763712#M85743</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;1. Each _DaySinceEndElapsed is calculated as date difference in days between StartDate and previous EndDate. For example, in yellow group:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;2. Then filter is applied that just filter out every second row. So I need _DaysSinceEndElapsed recalculate like this&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 08:27:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-that-dynamically-calculates-date-difference-between/m-p/2763712#M85743</guid>
      <dc:creator>anonymous3</dc:creator>
      <dc:date>2022-09-13T08:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: Measure that dynamically calculates date difference between consecutive rows in a group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-that-dynamically-calculates-date-difference-between/m-p/2763798#M85753</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="438738" data-lia-user-login="anonymous3" class="lia-mention lia-mention-user"&gt;anonymous3&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I have created a simple sample, please refer to it to see if it helps you.&lt;/P&gt;
&lt;P&gt;Create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;_DaysSinceEndElapsed =
VAR _enddate =
    CALCULATE (
        MAX ( 'table'[enddate] ),
        FILTER (
            ALLSELECTED ( 'table' ),
            'table'[Group] = SELECTEDVALUE ( 'table'[Group] )
                &amp;amp;&amp;amp; 'table'[id] &amp;lt; SELECTEDVALUE ( 'table'[id] )
        )
    )
VAR _startdate =
    MAX ( 'table'[startdate] )
RETURN
    DATEDIFF ( _enddate, _startdate, DAY )
&lt;/LI-CODE&gt;
&lt;P&gt;Then put the id column into the slicer.&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;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If I have misunderstood your meaning, please provide more details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ Polly&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 08:50:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-that-dynamically-calculates-date-difference-between/m-p/2763798#M85753</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-13T08:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: Measure that dynamically calculates date difference between consecutive rows in a group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-that-dynamically-calculates-date-difference-between/m-p/2763887#M85768</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 09:33:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-that-dynamically-calculates-date-difference-between/m-p/2763887#M85768</guid>
      <dc:creator>anonymous3</dc:creator>
      <dc:date>2022-09-13T09:33:47Z</dc:date>
    </item>
  </channel>
</rss>

