<?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: Conditional reference to another row in table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-reference-to-another-row-in-table/m-p/817572#M5476</link>
    <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92178" data-lia-user-login="AlB" class="lia-mention lia-mention-user"&gt;AlB&lt;/a&gt;&amp;nbsp;. Works perfectly. Could you give me an explanation as to why the Group doesn't need to be referenced in the NewCol formula?&lt;/P&gt;</description>
    <pubDate>Mon, 14 Oct 2019 19:00:05 GMT</pubDate>
    <dc:creator>cpmb</dc:creator>
    <dc:date>2019-10-14T19:00:05Z</dc:date>
    <item>
      <title>Conditional reference to another row in table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-reference-to-another-row-in-table/m-p/815215#M5379</link>
      <description>&lt;P&gt;Could somebody explain why I am getting the numbers below in the Output column? I had expected to get those in the Desired Output column instead. DAX Formulas are below.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Group&lt;/TD&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Value&lt;/TD&gt;&lt;TD&gt;Output&lt;/TD&gt;&lt;TD&gt;Desired Output&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/1/2019&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&g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;TD&gt;4&lt;/TD&gt;&lt;TD&gt;35&lt;/TD&gt;&lt;TD&gt;35&lt;/TD&gt;&lt;TD&gt;35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/2/2019&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;-10&lt;/TD&gt;&lt;TD&gt;35&lt;/TD&gt;&lt;TD&gt;35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/2/2019&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;-10&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output = IF(&lt;/P&gt;&lt;P&gt;Table[Value]&amp;lt;0,&lt;/P&gt;&lt;P&gt;CALCULATE([Measure],&lt;/P&gt;&lt;P&gt;FILTER(&lt;/P&gt;&lt;P&gt;SUMMARIZE(Table, Table[Date],Table[Group],Table[ID],Table[Value]),&lt;/P&gt;&lt;P&gt;Table[Date]=EARLIER(Table[Date]) &amp;amp;&amp;amp; Table[Group] = EARLIER(Table[Group]) &amp;amp;&amp;amp; Table[ID] &amp;lt;&amp;gt; EARLIER(Table[ID])&lt;/P&gt;&lt;P&gt;)), Table[Value])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure= CALCULATE(&lt;/P&gt;&lt;P&gt;SUM( Table[Value]),&lt;/P&gt;&lt;P&gt;ALLSELECTED(Table[ID]),&lt;/P&gt;&lt;P&gt;FILTER(Table, Table[Date]=Table[Date] &amp;amp;&amp;amp; Table[Group]=Table[Group] &amp;amp;&amp;amp; Table[ID] = Table[ID]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any explanation would be great, Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 20:35:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-reference-to-another-row-in-table/m-p/815215#M5379</guid>
      <dc:creator>cpmb</dc:creator>
      <dc:date>2019-10-10T20:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional reference to another row in table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-reference-to-another-row-in-table/m-p/816375#M5412</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="176557" data-lia-user-login="cpmb" class="lia-mention lia-mention-user"&gt;cpmb&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you explain how the correct numbers are calculated, what the logic is?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider giving kudos if posts are helpful.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&amp;nbsp;&lt;IMG src="https://community.fabric.microsoft.com/html/badge_icons/SU18_powerbi_badge.png" border="0" alt="Datanaut" width="64" height="64" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 08:46:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-reference-to-another-row-in-table/m-p/816375#M5412</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2019-10-14T08:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional reference to another row in table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-reference-to-another-row-in-table/m-p/816669#M5428</link>
      <description>&lt;P&gt;The logic is: if Value is negative, take the Value of another ID in the Group (ideally the max).&lt;/P&gt;</description>
      <pubDate>Sun, 13 Oct 2019 23:04:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-reference-to-another-row-in-table/m-p/816669#M5428</guid>
      <dc:creator>cpmb</dc:creator>
      <dc:date>2019-10-13T23:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional reference to another row in table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-reference-to-another-row-in-table/m-p/817029#M5445</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;NewCol =
IF (
    Table1[Value] &amp;lt; 0,
    CALCULATE ( MAX ( Table1[Value] ), ALL ( Table1[ID], Table1[Value] ) ),
    Table1[Value]
)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider giving kudos if posts are helpful.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&amp;nbsp;&lt;IMG src="https://community.fabric.microsoft.com/html/badge_icons/SU18_powerbi_badge.png" border="0" alt="Datanaut" width="64" height="64" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 08:51:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-reference-to-another-row-in-table/m-p/817029#M5445</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2019-10-14T08:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional reference to another row in table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-reference-to-another-row-in-table/m-p/817572#M5476</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92178" data-lia-user-login="AlB" class="lia-mention lia-mention-user"&gt;AlB&lt;/a&gt;&amp;nbsp;. Works perfectly. Could you give me an explanation as to why the Group doesn't need to be referenced in the NewCol formula?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 19:00:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-reference-to-another-row-in-table/m-p/817572#M5476</guid>
      <dc:creator>cpmb</dc:creator>
      <dc:date>2019-10-14T19:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional reference to another row in table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-reference-to-another-row-in-table/m-p/817622#M5480</link>
      <description>&lt;P&gt;Sure, cause we want to look at the max by Date and Group, right? Context transition establishes filters on those only since with the ALL( ) we are eliminating the filters on ID and Value.&lt;/P&gt;
&lt;P&gt;If you're not familiar with context transition check&amp;nbsp;this out:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/understanding-context-transition/" target="_blank" rel="noopener"&gt;https://www.sqlbi.com/articles/understanding-context-transition/&lt;/A&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider giving kudos if posts are helpful.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&amp;nbsp;&lt;IMG src="https://community.fabric.microsoft.com/html/badge_icons/SU18_powerbi_badge.png" border="0" alt="Datanaut" width="64" height="64" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 20:22:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-reference-to-another-row-in-table/m-p/817622#M5480</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2019-10-14T20:22:47Z</dc:date>
    </item>
  </channel>
</rss>

