<?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: Group range of dates in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2421919#M64199</link>
    <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Can you please take a look at the sample of the file, with the exact column names that I am using, I don't know why I'm not able to use the formula as you shared with me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the calculated columns, after the =EARLIER the errors start to appear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;MACHINE = MCH_CODE&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;VARIABLE = REMARK (3 options: 7TC, 7TF, 7TJ), these are the working sites, no math is involved with this column.&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;REG_DATE = Date + Time of the registry&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;RECORDED_VALUE = Value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Link below (can't attach files directly)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.dropbox.com/s/0zbcjbn253vg3vs/PBI%20Sample%20FIle.pbix?dl=0" target="_blank"&gt;https://www.dropbox.com/s/0zbcjbn253vg3vs/PBI%20Sample%20FIle.pbix?dl=0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help!&lt;/P&gt;</description>
    <pubDate>Mon, 28 Mar 2022 14:59:34 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-03-28T14:59:34Z</dc:date>
    <item>
      <title>Group range of dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2413179#M63655</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a database (simplified model below) where I have the following columns:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Machine&lt;/LI&gt;&lt;LI&gt;Date&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;Variable (has 3 possible values)&lt;/LI&gt;&lt;LI&gt;Value&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I need to group of the range of consecutive days where the "Variable" is the same and to show min / max values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See example below, each colour represents a new range (variable changed from 1 to 2, and from 2 to 1).&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;P&gt;OBS: The "Index" column is not available in my database, I inserted in the Excel table for demonstration only.&lt;/P&gt;&lt;P&gt;Is there a possible way to do that via DAX?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 17:57:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2413179#M63655</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-23T17:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: Group range of dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2413196#M63658</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just create measures with simple MIN/MAX of each column&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 18:11:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2413196#M63658</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-23T18:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Group range of dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2413205#M63659</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;, thanks for your time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I should have explained better, but when I create simple measures with MIN/MAX I am going to have as an outcome the entire dataset and I need the MIN/MAX for the "Index" (range of consecutive days).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please see picture below:&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;</description>
      <pubDate>Wed, 23 Mar 2022 18:17:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2413205#M63659</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-23T18:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Group range of dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2413212#M63660</link>
      <description>&lt;P&gt;Do you already have the index column or you want to create it?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 18:24:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2413212#M63660</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-23T18:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Group range of dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2413221#M63661</link>
      <description>&lt;P&gt;I need to create it.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 18:30:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2413221#M63661</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-23T18:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: Group range of dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2413905#M63690</link>
      <description>&lt;P&gt;Sorry&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;I just saw your reply.&amp;nbsp;&lt;BR /&gt;Yes the index column can be created by dividing the rank over 3 (the group size) We just need to round it up to conver to ineger.&lt;/P&gt;&lt;LI-CODE lang="php"&gt;INDEX = 
VAR GroupSize = 3
VAR Ranking =
    RANKX ( 
        CALCULATETABLE ( Data, ALLEXCEPT ( Data, Data[MACHINE] ) ),
        Data[DATE],,
        ASC
    )
VAR Result =
    ROUNDUP ( DIVIDE ( Ranking, GroupSize ), 0 )
RETURN 
    Result&lt;/LI-CODE&gt;&lt;P&gt;Here is a sample file for your reference&amp;nbsp;&lt;A href="https://www.dropbox.com/t/gUbW1KY31MOVROXc" target="_blank"&gt;https://www.dropbox.com/t/gUbW1KY31MOVROXc&lt;/A&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 03:55:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2413905#M63690</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-24T03:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: Group range of dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2415017#M63769</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;I really appreciate that you're taking your time to help me but unfornately the solution is not as expected. There is only 1 machine "A" in the example. I wrote only 3 lines per "index" but there can be as many as possible for each condition so there is no rule for that also. Any ideas?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;OBS: There are several records for each machine daily...&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 12:28:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2415017#M63769</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-24T12:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: Group range of dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2415033#M63773</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Regarding the error, this code is for a calculated column not a measure.&amp;nbsp;&lt;BR /&gt;Regarding the group size actually I anticipated that you would say that. And my question is: if not fixed then based on what?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 12:36:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2415033#M63773</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-24T12:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: Group range of dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2420689#M64114</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please firstly add a Index column in Power Query:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then create columns:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Flag = 
var _pre= CALCULATE(MAX('Table'[VARIABLE]),FILTER('Table',[MACHINE]=EARLIER('Table'[MACHINE]) &amp;amp;&amp;amp; [Index]=EARLIER('Table'[Index])-1))
return IF([VARIABLE]&amp;lt;&amp;gt;_pre,[Index])&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Filled Flag = MAXX(FILTER('Table',[MACHINE]=EARLIER('Table'[MACHINE]) &amp;amp;&amp;amp; [Index]&amp;lt;=EARLIER('Table'[Index])),[Flag]) &lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Rank(Grouped Index) = RANKX(FILTER('Table',[MACHINE]=EARLIER('Table'[MACHINE])),[Filled Flag],,ASC,Dense) &lt;/LI-CODE&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&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;P&gt;Best Regards,&lt;BR /&gt;Eyelyn Qin&lt;BR /&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 07:33:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2420689#M64114</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-28T07:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: Group range of dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2421919#M64199</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Can you please take a look at the sample of the file, with the exact column names that I am using, I don't know why I'm not able to use the formula as you shared with me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the calculated columns, after the =EARLIER the errors start to appear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;MACHINE = MCH_CODE&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;VARIABLE = REMARK (3 options: 7TC, 7TF, 7TJ), these are the working sites, no math is involved with this column.&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;REG_DATE = Date + Time of the registry&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;RECORDED_VALUE = Value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Link below (can't attach files directly)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.dropbox.com/s/0zbcjbn253vg3vs/PBI%20Sample%20FIle.pbix?dl=0" target="_blank"&gt;https://www.dropbox.com/s/0zbcjbn253vg3vs/PBI%20Sample%20FIle.pbix?dl=0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 14:59:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-range-of-dates/m-p/2421919#M64199</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-28T14:59:34Z</dc:date>
    </item>
  </channel>
</rss>

