<?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: How to get value of the next row for a certain category? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-value-of-the-next-row-for-a-certain-category/m-p/2565313#M73072</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="299999" data-lia-user-login="justlogmein" class="lia-mention lia-mention-user"&gt;justlogmein&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please modify your formula.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Column =
CALCULATE (
    MIN ( 'Sample Date'[Sample Date] ),
    FILTER (
        'Sample Date',
        'Sample Date'[Sample Date] &amp;gt; EARLIER ( 'Sample Date'[Sample Date] )
            &amp;amp;&amp;amp; 'Sample Date'[unit number] = EARLIER ( 'Sample Date'[unit number] )
    )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Or try to use&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;&amp;nbsp;'s way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I have misunderstood your meaning, please provide your pbix file without privacy information and desired output.&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>Wed, 08 Jun 2022 02:00:14 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-06-08T02:00:14Z</dc:date>
    <item>
      <title>How to get value of the next row for a certain category?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-value-of-the-next-row-for-a-certain-category/m-p/2559316#M72763</link>
      <description>&lt;P&gt;I have been able to create a calculated column using the EARLIER function, however I am unsure on how to find the next row (or more than 1 row earlier for that matter).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The DAX below is what I have used to find the previous Sample Date for the same unit number. Can someone please tell me how I would find the next sample date and if there is a better way of writing my current formula? I feel like using MAX or SUM here is a little dodgy as I am not actually finding either, I just want to return a single value.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;=
CALCULATE 
	(
	MAX
		(
		[Sample Date]
		),
	FILTER
		(
		'Sample Data',
		'Sample Data'[Sample Date] &amp;lt; EARLIER
			( 
			'Sample Data'[Sample Date]
			) 
		),
	'Sample Data'[Unit Number] = EARLIER
		(
		'Sample Data'[Unit Number]
		)
	)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 07:50:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-value-of-the-next-row-for-a-certain-category/m-p/2559316#M72763</guid>
      <dc:creator>justlogmein</dc:creator>
      <dc:date>2022-06-05T07:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to get value of the next row for a certain category?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-value-of-the-next-row-for-a-certain-category/m-p/2559329#M72764</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="299999" data-lia-user-login="justlogmein" class="lia-mention lia-mention-user"&gt;justlogmein&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NewCol = 
VAR previousDate_ =
    CALCULATE (
        MAX ( [Sample Date] ),
        'Sample Data'[Sample Date] &amp;lt; EARLIER ( 'Sample Data'[Sample Date] ),
        ALLEXCEPT ( 'Sample Data', 'Sample Data'[Unit Number] )
    )
RETURN
    CALCULATE (
        MAX ( [Sample Date] ),
        'Sample Data'[Sample Date] &amp;lt; previousDate_,
        ALLEXCEPT ( 'Sample Data', 'Sample Data'[Unit Number] )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="height: 100px; width: 100%; border-collapse: collapse; border-style: groove; border-color: #0c1c49; background-color: #00675f;" border="0" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15px;"&gt;
&lt;TD width="15.961305925030231%" style="width: 92px; height: 15px;"&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84.03869407496977%" style="width: 485px; height: 15px; text-align: left;"&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Please accept the solution when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; &lt;/FONT&gt;&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4.5" color="#FF99CC"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 08:18:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-value-of-the-next-row-for-a-certain-category/m-p/2559329#M72764</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2022-06-05T08:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get value of the next row for a certain category?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-value-of-the-next-row-for-a-certain-category/m-p/2559330#M72765</link>
      <description>&lt;P&gt;Or if you want&amp;nbsp; more generic solution, , where you can specify the poisition you want by changing N_&amp;nbsp; (4th last in the example): &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;A =
VAR N_ = 4 // 1 is the immediately previous, 2 is the one before and so forth 
VAR auxT_ =
    TOPN (
        N_,
        CALCULATETABLE (
            DISTINCT ( 'Sample Data'[Sample Date] ),
            'Sample Data'[Sample Date] &amp;lt; EARLIER ( 'Sample Data'[Sample Date] ),
            ALLEXCEPT ( 'Sample Data', 'Sample Data'[Unit Number] )
        ),
        'Sample Data'[Sample Date], DESC
    )
RETURN
    MINX ( auxT, 'Sample Data'[Sample Date] )
&lt;/LI-CODE&gt;
&lt;TABLE style="height: 100px; width: 100%; border-collapse: collapse; border-style: groove; border-color: #0c1c49; background-color: #00675f;" border="0" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15px;"&gt;
&lt;TD width="15.961305925030231%" style="width: 92px; height: 15px;"&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84.03869407496977%" style="width: 485px; height: 15px; text-align: left;"&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Please accept the solution when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; &lt;/FONT&gt;&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4.5" color="#FF99CC"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 08:26:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-value-of-the-next-row-for-a-certain-category/m-p/2559330#M72765</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2022-06-05T08:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to get value of the next row for a certain category?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-value-of-the-next-row-for-a-certain-category/m-p/2559332#M72766</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="299999" data-lia-user-login="justlogmein" class="lia-mention lia-mention-user"&gt;justlogmein&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please use&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Top 1 Unit Number =
VAR CategoryTable =
    CALCULATETABLE (
        'Sample Data',
        ALLEXCEPT ( 'Sample Data', 'Sample Data'[Category] )
    )
VAR Top1Value =
    MAXX ( CategoryTable, 'Sample Data'[Sample Date] )
VAR Top1UnitNumber =
    MAXX (
        FILTER ( Top2Table, 'Sample Data'[Sample Date] = Top1Value ),
        'Sample Data'[Unit Number]
    )
RETURN
    Top1UnitNumber&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;2nd Top Unit Number =
VAR CategoryTable =
    CALCULATETABLE (
        'Sample Data',
        ALLEXCEPT ( 'Sample Data', 'Sample Data'[Category] )
    )
VAR Top2Table =
    TOPN ( 2, CategoryTable, 'Sample Data'[Sample Date] )
VAR Top2Value =
    MINX ( Top2Table, 'Sample Data'[Sample Date] )
VAR Top2UnitNumber =
    MAXX (
        FILTER ( Top2Table, 'Sample Data'[Sample Date] = Top2Value ),
        'Sample Data'[Unit Number]
    )
RETURN
    Top2UnitNumber&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 09:18:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-value-of-the-next-row-for-a-certain-category/m-p/2559332#M72766</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-05T09:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to get value of the next row for a certain category?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-value-of-the-next-row-for-a-certain-category/m-p/2559389#M72768</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please try the below for creating a new column.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;next sample date CC =
MINX (
    FILTER (
        'Sample Data',
        'Sample Data'[Sample Date] &amp;gt; EARLIER ( 'Sample Data'[Sample Date] )
            &amp;amp;&amp;amp; 'Sample Data'[Unit Number] = EARLIER ( 'Sample Data'[Unit Number] )
    ),
    'Sample Data'[Sample Date]
)
&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 05 Jun 2022 09:35:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-value-of-the-next-row-for-a-certain-category/m-p/2559389#M72768</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-06-05T09:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to get value of the next row for a certain category?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-value-of-the-next-row-for-a-certain-category/m-p/2565313#M73072</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="299999" data-lia-user-login="justlogmein" class="lia-mention lia-mention-user"&gt;justlogmein&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please modify your formula.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Column =
CALCULATE (
    MIN ( 'Sample Date'[Sample Date] ),
    FILTER (
        'Sample Date',
        'Sample Date'[Sample Date] &amp;gt; EARLIER ( 'Sample Date'[Sample Date] )
            &amp;amp;&amp;amp; 'Sample Date'[unit number] = EARLIER ( 'Sample Date'[unit number] )
    )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Or try to use&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;&amp;nbsp;'s way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I have misunderstood your meaning, please provide your pbix file without privacy information and desired output.&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>Wed, 08 Jun 2022 02:00:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-value-of-the-next-row-for-a-certain-category/m-p/2565313#M73072</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-08T02:00:14Z</dc:date>
    </item>
  </channel>
</rss>

