<?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 How to avoid circular dependency when I the value of the column is its previous value plus other val in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-avoid-circular-dependency-when-I-the-value-of-the-column/m-p/2774597#M86543</link>
    <description>&lt;P&gt;Hi all.&lt;/P&gt;&lt;P&gt;I'm facing with a circular dependency error and all I tried not solved.&lt;BR /&gt;I have 3 columns:&lt;BR /&gt;Column A&lt;BR /&gt;Column B&lt;BR /&gt;Column C&lt;/P&gt;&lt;P&gt;The value of the column C is&lt;BR /&gt;(A + [previous value of C]) - B&lt;/P&gt;&lt;P&gt;Some trick to achieve this?&lt;/P&gt;&lt;P&gt;This image show how I did this in excel&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Sep 2022 21:02:30 GMT</pubDate>
    <dc:creator>wellidyalmeida</dc:creator>
    <dc:date>2022-09-16T21:02:30Z</dc:date>
    <item>
      <title>How to avoid circular dependency when I the value of the column is its previous value plus other val</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-avoid-circular-dependency-when-I-the-value-of-the-column/m-p/2774597#M86543</link>
      <description>&lt;P&gt;Hi all.&lt;/P&gt;&lt;P&gt;I'm facing with a circular dependency error and all I tried not solved.&lt;BR /&gt;I have 3 columns:&lt;BR /&gt;Column A&lt;BR /&gt;Column B&lt;BR /&gt;Column C&lt;/P&gt;&lt;P&gt;The value of the column C is&lt;BR /&gt;(A + [previous value of C]) - B&lt;/P&gt;&lt;P&gt;Some trick to achieve this?&lt;/P&gt;&lt;P&gt;This image show how I did this in excel&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 21:02:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-avoid-circular-dependency-when-I-the-value-of-the-column/m-p/2774597#M86543</guid>
      <dc:creator>wellidyalmeida</dc:creator>
      <dc:date>2022-09-16T21:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid circular dependency when I the value of the column is its previous value plus other val</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-avoid-circular-dependency-when-I-the-value-of-the-column/m-p/2774855#M86570</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="443233" data-lia-user-login="wellidyalmeida" class="lia-mention lia-mention-user"&gt;wellidyalmeida&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;This is called recursive calculation which is not supported by Power Bi as the DAX engine evaluates the calculated column or the measure at once.&amp;nbsp;&lt;BR /&gt;However, there is a workaround and in this specific case it is not complicated. For this to work properly you need to specify the following:&amp;nbsp;&lt;BR /&gt;1. The starting value for Column C&lt;/P&gt;
&lt;P&gt;2. What you state as Column A,&amp;nbsp;Column B &amp;amp;&amp;nbsp;Column C, are they columns or measures?&lt;BR /&gt;Attached is a sample file tailored&amp;nbsp;to match your requirement for both calculated column and measure options&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;C = 
VAR StartingValue = 2000
VAR MinDate = MIN ( Table1[Date] )
VAR CurrentDate = Table1[Date] 
VAR FilteredTable = FILTER ( Table1, Table1[Date] &amp;gt; MinDate &amp;amp;&amp;amp; Table1[Date] &amp;lt;= CurrentDate )
VAR RecursiveValue = SUMX ( FilteredTable, [A] - [B] )
RETURN
    StartingValue + RecursiveValue&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&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;Measure C = 
VAR StartingValue = 2000
VAR SelectedDates = ALLSELECTED ( Table2[Date] ) 
VAR MinDate = MINX ( SelectedDates, Table2[Date] )
VAR CurrentDate = MAX ( Table2[Date] )
VAR FilteredTable = FILTER ( SelectedDates, Table2[Date] &amp;gt; MinDate &amp;amp;&amp;amp; Table2[Date] &amp;lt;= CurrentDate )
VAR MeasuresTable = ADDCOLUMNS ( FilteredTable, "@A", [Measure A], "@B", [Measure B] )
VAR RecursiveValue = SUMX ( MeasuresTable, [@A] - [@B] )
RETURN
    StartingValue + RecursiveValue&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Sep 2022 07:52:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-avoid-circular-dependency-when-I-the-value-of-the-column/m-p/2774855#M86570</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-09-17T07:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid circular dependency when I the value of the column is its previous value plus other val</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-avoid-circular-dependency-when-I-the-value-of-the-column/m-p/2807288#M88660</link>
      <description>&lt;P&gt;Thank you,&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;. This solved the problem.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 20:44:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-avoid-circular-dependency-when-I-the-value-of-the-column/m-p/2807288#M88660</guid>
      <dc:creator>wellidyalmeida</dc:creator>
      <dc:date>2022-09-29T20:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid circular dependency when I the value of the column is its previous value plus other val</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-avoid-circular-dependency-when-I-the-value-of-the-column/m-p/2831804#M90243</link>
      <description>&lt;P&gt;Hi,&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 need your help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The value of Column C is not correct.&lt;/P&gt;&lt;P&gt;I've been debuged every value used in the calculation, unfortunelly, I coundn´t understand what is wrong.&lt;/P&gt;&lt;P&gt;I used the COLUMN SOLUTION.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me, please?&lt;/P&gt;&lt;P&gt;I attached pbix and explaning it:&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1eX9hO1uNTAd1gaV3i57e-mvZ1kiqllfk/view?usp=sharing" target="_blank"&gt;https://drive.google.com/file/d/1eX9hO1uNTAd1gaV3i57e-mvZ1kiqllfk/view?usp=sharing&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Starting value is&amp;nbsp;359606 and come from the 'saldo inicial' table.&lt;/P&gt;&lt;P&gt;The calculated column is in the 'contas_vw' table in the column 'C'&lt;/P&gt;&lt;P&gt;The expected value is 181.737,87 but I got&amp;nbsp;182.367,83 as you can see in this image&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 17:35:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-avoid-circular-dependency-when-I-the-value-of-the-column/m-p/2831804#M90243</guid>
      <dc:creator>wellidyalmeida</dc:creator>
      <dc:date>2022-10-10T17:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid circular dependency when I the value of the column is its previous value plus other val</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-avoid-circular-dependency-when-I-the-value-of-the-column/m-p/2834628#M90397</link>
      <description>&lt;P&gt;Solved!&lt;/P&gt;&lt;P&gt;The original solution from&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;is correct.&lt;/P&gt;&lt;P&gt;The sequence that calculated columns are evaluated caused the problem. My column C, beside the recursive calculation, has conditionals that gave me headache.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 16:46:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-avoid-circular-dependency-when-I-the-value-of-the-column/m-p/2834628#M90397</guid>
      <dc:creator>wellidyalmeida</dc:creator>
      <dc:date>2022-10-11T16:46:52Z</dc:date>
    </item>
  </channel>
</rss>

