<?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 Max interval of days between two dates on date column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-interval-of-days-between-two-dates-on-date-column/m-p/2392533#M62283</link>
    <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to calculate the interval of days between a date value and the last date before that date (doing this to all dates in column), and then show the max value of these intervals.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;1. calculate the date intervals between the dates on column:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. and then return the max value from the intervals calculated above (&lt;STRONG&gt;6&lt;/STRONG&gt;&lt;STRONG&gt;&amp;nbsp;days&lt;/STRONG&gt;), in a measure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate any help.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Mar 2022 13:39:24 GMT</pubDate>
    <dc:creator>filipeoliveira</dc:creator>
    <dc:date>2022-03-14T13:39:24Z</dc:date>
    <item>
      <title>Max interval of days between two dates on date column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-interval-of-days-between-two-dates-on-date-column/m-p/2392533#M62283</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to calculate the interval of days between a date value and the last date before that date (doing this to all dates in column), and then show the max value of these intervals.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;1. calculate the date intervals between the dates on column:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. and then return the max value from the intervals calculated above (&lt;STRONG&gt;6&lt;/STRONG&gt;&lt;STRONG&gt;&amp;nbsp;days&lt;/STRONG&gt;), in a measure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate any help.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2022 13:39:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-interval-of-days-between-two-dates-on-date-column/m-p/2392533#M62283</guid>
      <dc:creator>filipeoliveira</dc:creator>
      <dc:date>2022-03-14T13:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: Max interval of days between two dates on date column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-interval-of-days-between-two-dates-on-date-column/m-p/2392778#M62296</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="336154" data-lia-user-login="filipeoliveira" class="lia-mention lia-mention-user"&gt;filipeoliveira&lt;/a&gt; , A new column &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;datediff([Dateref], minx(filter(Table, [Dateref] &amp;gt;earlier([Dateref]) ), [DateRef]) , Day)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;datediff([Dateref], maxx(filter(Table, [Dateref] &amp;lt;earlier([Dateref]) ), [DateRef]) , Day)&lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2022 14:44:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-interval-of-days-between-two-dates-on-date-column/m-p/2392778#M62296</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-03-14T14:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Max interval of days between two dates on date column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-interval-of-days-between-two-dates-on-date-column/m-p/2392791#M62297</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&lt;/P&gt;
&lt;P&gt;I added two more rows in the sample in order to check if it works correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Expected result measure: =
VAR newtable =
    ADDCOLUMNS (
        Data,
        "@previous",
            CALCULATE (
                CALCULATE (
                    MAX ( Data[DataRef] ),
                    FILTER (
                        ALL ( Data ),
                        Data[DataRef] &amp;lt; VAR currentdataref = MAX ( Data[DataRef] ) RETURN currentdataref
                    )
                )
            )
    )
VAR intervaltable =
    FILTER (
        ADDCOLUMNS ( newtable, "@interval", INT ( Data[DataRef] - [@previous] ) ),
        [@previous] &amp;lt;&amp;gt; BLANK ()
    )
VAR maximuminterval =
    MAXX ( intervaltable, [@interval] )
RETURN
    maximuminterval
&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 14 Mar 2022 14:46:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-interval-of-days-between-two-dates-on-date-column/m-p/2392791#M62297</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-03-14T14:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: Max interval of days between two dates on date column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-interval-of-days-between-two-dates-on-date-column/m-p/2393114#M62317</link>
      <description>&lt;P&gt;Thanks! It worked for me.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2022 16:35:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-interval-of-days-between-two-dates-on-date-column/m-p/2393114#M62317</guid>
      <dc:creator>filipeoliveira</dc:creator>
      <dc:date>2022-03-14T16:35:11Z</dc:date>
    </item>
  </channel>
</rss>

