<?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: Circular dependency error while creating two inter dependent columns from other columns in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-error-while-creating-two-inter-dependent/m-p/1637510#M33236</link>
    <description>&lt;P&gt;Hi Pat (&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="226208" data-lia-user-login="mahoneypat" class="lia-mention lia-mention-user"&gt;mahoneypat&lt;/a&gt;&amp;nbsp;), Thanks for the help recently.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a scenario where, the data is like this...&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;which is clear that the purchased stock value is not available. But can be obtained and accounted for manually with the help of inventory department (which cannot be obtained while creating the above table). and for the first row in opening stock I can enter the opening stock value manually in Excel (as in the image below) but the same thing when I did in PowerBI, the things are breaking. and getting the negative values.&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;Moreover, there are categories of stock to be accounted in this data, for example there are 3 categories of stock, whose count need to be tracked on perday basis. (not mandatory that each category of stock is sold on a particular date and also not mandatory that when stock is purchased all categories of stock are purchased on a particular date).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would be very thankful if you could help me obtain solution for these. And help from any community members is verymuch invited.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in Advance.&lt;/P&gt;</description>
    <pubDate>Tue, 02 Feb 2021 03:22:19 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-02-02T03:22:19Z</dc:date>
    <item>
      <title>Circular dependency error while creating two inter dependent columns from other columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-error-while-creating-two-inter-dependent/m-p/1633219#M33114</link>
      <description>&lt;P&gt;Hi to all the members of enthusiastic and supportive community.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to create two columns "closing stock" and "opening stock" columns based on "date", "purchased stock", and "sold stock".&lt;/P&gt;&lt;P&gt;The data sample is like below:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to get the table with calculated columns as below using DAX (in Power BI).&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have used these formulae to create calculated columns but causing Circular Dependency Error.&lt;/P&gt;&lt;PRE&gt;Opening Stock = &lt;BR /&gt;VAR PreviousRow =&lt;BR /&gt;    TOPN (&lt;BR /&gt;        1,&lt;BR /&gt;        FILTER (&lt;BR /&gt;            'Table1',&lt;BR /&gt;            'Table1'[Date] &amp;lt; EARLIER ( 'Table1'[Date] )&lt;BR /&gt;        ),&lt;BR /&gt;        'Table1'[Date], DESC&lt;BR /&gt;    )&lt;BR /&gt;VAR PreviousValue =&lt;BR /&gt;    IF(&lt;BR /&gt;        MINX ( PreviousRow, 'Table1'[Closing Stock] ) = BLANK(), &lt;BR /&gt;        [Purchased Stock], &lt;BR /&gt;        MINX ( PreviousRow, 'Table1'[Closing Stock] )&lt;BR /&gt;    )&lt;BR /&gt;RETURN&lt;BR /&gt;    PreviousValue&lt;BR /&gt;&lt;BR /&gt;---------------------------------&lt;BR /&gt;&lt;BR /&gt;Closing Stock = IF(&lt;BR /&gt;    [Purchased Stock] &amp;lt;&amp;gt; BLANK(),&lt;BR /&gt;    [Purchased Stock] + [Opening Stock] - [Sold Stock],&lt;BR /&gt;    [Opening Stock] - [Sold Stock]&lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;I was able to get the logic for Opening Stock column from&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="42973" data-lia-user-login="Zubair_Muhammad" class="lia-mention lia-mention-user"&gt;Zubair_Muhammad&lt;/a&gt;. &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="42973" data-lia-user-login="Zubair_Muhammad" class="lia-mention lia-mention-user"&gt;Zubair_Muhammad&lt;/a&gt;, it would be great if you or anyone from the community helped me obtain the solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me to arrive to a solution..&lt;/P&gt;&lt;P&gt;Thanks in Advance.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jan 2021 12:32:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-error-while-creating-two-inter-dependent/m-p/1633219#M33114</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-01-30T12:32:36Z</dc:date>
    </item>
    <item>
      <title>Re: Circular dependency error while creating two inter dependent columns from other columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-error-while-creating-two-inter-dependent/m-p/1633311#M33117</link>
      <description>&lt;P&gt;Please try these column expressions instead, replacing StockSales with your actual table name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Opening Stock = var vThisDate = StockSales[Date]&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;var vPurchases = CALCULATE(SUM(StockSales[Purchased Stock]), All(StockSales), StockSales[Date] &amp;lt;= vThisDate)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;var vSales = CALCULATE(SUM(StockSales[Sold Stock]), all(StockSales), StockSales[Date] &amp;lt; vThisDate)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;return vPurchases - vSales&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Closing Stock = var vThisDate = StockSales[Date]&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;var vPurchases = CALCULATE(SUM(StockSales[Purchased Stock]), all(StockSales), StockSales[Date] &amp;lt;= vThisDate)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;var vSales = CALCULATE(SUM(StockSales[Sold Stock]), All(StockSales), StockSales[Date] &amp;lt;= vThisDate)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;return vPurchases - vSales&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Pat&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Sat, 30 Jan 2021 14:34:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-error-while-creating-two-inter-dependent/m-p/1633311#M33117</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2021-01-30T14:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: Circular dependency error while creating two inter dependent columns from other columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-error-while-creating-two-inter-dependent/m-p/1633411#M33125</link>
      <description>&lt;P&gt;That worked like a charm. Thanks a lot&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="226208" data-lia-user-login="mahoneypat" class="lia-mention lia-mention-user"&gt;mahoneypat&lt;/a&gt;.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jan 2021 18:21:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-error-while-creating-two-inter-dependent/m-p/1633411#M33125</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-01-30T18:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: Circular dependency error while creating two inter dependent columns from other columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-error-while-creating-two-inter-dependent/m-p/1637510#M33236</link>
      <description>&lt;P&gt;Hi Pat (&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="226208" data-lia-user-login="mahoneypat" class="lia-mention lia-mention-user"&gt;mahoneypat&lt;/a&gt;&amp;nbsp;), Thanks for the help recently.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a scenario where, the data is like this...&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;which is clear that the purchased stock value is not available. But can be obtained and accounted for manually with the help of inventory department (which cannot be obtained while creating the above table). and for the first row in opening stock I can enter the opening stock value manually in Excel (as in the image below) but the same thing when I did in PowerBI, the things are breaking. and getting the negative values.&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;Moreover, there are categories of stock to be accounted in this data, for example there are 3 categories of stock, whose count need to be tracked on perday basis. (not mandatory that each category of stock is sold on a particular date and also not mandatory that when stock is purchased all categories of stock are purchased on a particular date).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would be very thankful if you could help me obtain solution for these. And help from any community members is verymuch invited.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in Advance.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 03:22:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-error-while-creating-two-inter-dependent/m-p/1637510#M33236</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-02-02T03:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: Circular dependency error while creating two inter dependent columns from other columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-error-while-creating-two-inter-dependent/m-p/1639020#M33272</link>
      <description>&lt;P&gt;Would this approach work, adding in an initial value?&amp;nbsp; It is hardcoded below but it could be a dynamic expression with a value from another table you bring in.&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;Opening&amp;nbsp;Stock&amp;nbsp;=&lt;BR /&gt;&lt;SPAN class="Keyword" style="color: #035aca;"&gt;VAR&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class="Variable" style="color: #49b0af;"&gt;vInitValue&lt;/SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;SPAN class="Number" style="color: #ee7f18;"&gt;100&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class="Comment" style="color: #39a03b;"&gt;//&amp;nbsp;or&amp;nbsp;use&amp;nbsp;dynamic&amp;nbsp;expression&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="Keyword" style="color: #035aca;"&gt;VAR&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class="Variable" style="color: #49b0af;"&gt;vThisDate&lt;/SPAN&gt;&amp;nbsp;=&amp;nbsp;StockSales[Date]&lt;BR /&gt;&lt;SPAN class="Keyword" style="color: #035aca;"&gt;VAR&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class="Variable" style="color: #49b0af;"&gt;vPurchases&lt;/SPAN&gt;&amp;nbsp;=&lt;BR /&gt;&lt;SPAN class="indent4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="Keyword" style="color: #035aca;"&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN class="Parenthesis" style="color: #808080;"&gt;&amp;nbsp;(&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="indent8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="Keyword" style="color: #035aca;"&gt;SUM&lt;/SPAN&gt;&lt;SPAN class="Parenthesis" style="color: #808080;"&gt;&amp;nbsp;(&lt;/SPAN&gt;&amp;nbsp;StockSales[Purchased&amp;nbsp;Stock]&amp;nbsp;&lt;SPAN class="Parenthesis" style="color: #808080;"&gt;)&lt;/SPAN&gt;,&lt;BR /&gt;&lt;SPAN class="indent8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="Keyword" style="color: #035aca;"&gt;ALL&lt;/SPAN&gt;&lt;SPAN class="Parenthesis" style="color: #808080;"&gt;&amp;nbsp;(&lt;/SPAN&gt;&amp;nbsp;StockSales&amp;nbsp;&lt;SPAN class="Parenthesis" style="color: #808080;"&gt;)&lt;/SPAN&gt;,&lt;BR /&gt;&lt;SPAN class="indent8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;StockSales[Date]&amp;nbsp;&amp;lt;=&amp;nbsp;&lt;SPAN class="Variable" style="color: #49b0af;"&gt;vThisDate&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="indent4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="Parenthesis" style="color: #808080;"&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="Keyword" style="color: #035aca;"&gt;VAR&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class="Variable" style="color: #49b0af;"&gt;vSales&lt;/SPAN&gt;&amp;nbsp;=&lt;BR /&gt;&lt;SPAN class="indent4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="Keyword" style="color: #035aca;"&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN class="Parenthesis" style="color: #808080;"&gt;&amp;nbsp;(&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="indent8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="Keyword" style="color: #035aca;"&gt;SUM&lt;/SPAN&gt;&lt;SPAN class="Parenthesis" style="color: #808080;"&gt;&amp;nbsp;(&lt;/SPAN&gt;&amp;nbsp;StockSales[Sold&amp;nbsp;Stock]&amp;nbsp;&lt;SPAN class="Parenthesis" style="color: #808080;"&gt;)&lt;/SPAN&gt;,&lt;BR /&gt;&lt;SPAN class="indent8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="Keyword" style="color: #035aca;"&gt;ALL&lt;/SPAN&gt;&lt;SPAN class="Parenthesis" style="color: #808080;"&gt;&amp;nbsp;(&lt;/SPAN&gt;&amp;nbsp;StockSales&amp;nbsp;&lt;SPAN class="Parenthesis" style="color: #808080;"&gt;)&lt;/SPAN&gt;,&lt;BR /&gt;&lt;SPAN class="indent8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;StockSales[Date]&amp;nbsp;&amp;lt;&amp;nbsp;&lt;SPAN class="Variable" style="color: #49b0af;"&gt;vThisDate&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="indent4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="Parenthesis" style="color: #808080;"&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="Keyword" style="color: #035aca;"&gt;RETURN&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="indent4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="Variable" style="color: #49b0af;"&gt;vInitValue&lt;/SPAN&gt;&amp;nbsp;+&amp;nbsp;&lt;SPAN class="Variable" style="color: #49b0af;"&gt;vPurchases&lt;/SPAN&gt;&amp;nbsp;-&amp;nbsp;&lt;SPAN class="Variable" style="color: #49b0af;"&gt;vSales&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Pat&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 02 Feb 2021 12:47:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-error-while-creating-two-inter-dependent/m-p/1639020#M33272</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2021-02-02T12:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: Circular dependency error while creating two inter dependent columns from other columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-error-while-creating-two-inter-dependent/m-p/1642649#M33386</link>
      <description>&lt;P&gt;Thanks for the suggestion Pat (&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="226208" data-lia-user-login="mahoneypat" class="lia-mention lia-mention-user"&gt;mahoneypat&lt;/a&gt;&amp;nbsp; ).&lt;/P&gt;&lt;P&gt;It certainly helped me and there were a few corrections to be made at other (prior) stages in my data. Now result is as expected after dealing with those corrections and changes.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 16:41:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-error-while-creating-two-inter-dependent/m-p/1642649#M33386</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-02-03T16:41:03Z</dc:date>
    </item>
  </channel>
</rss>

