<?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: Dax circular dependency error on calculated column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-circular-dependency-error-on-calculated-column/m-p/3811782#M149069</link>
    <description>&lt;P&gt;Please install previous version(2024-02). It will be no issue at all.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Apr 2024 18:50:52 GMT</pubDate>
    <dc:creator>JamesKim</dc:creator>
    <dc:date>2024-04-04T18:50:52Z</dc:date>
    <item>
      <title>Dax circular dependency error on calculated column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-circular-dependency-error-on-calculated-column/m-p/3758424#M146633</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting a circular dependency error and not sure how to solve it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a source table (General) with a column "Amount". This amount can be incl Tax or excl Tax depending on the document type.&lt;/P&gt;&lt;P&gt;The source table has also a column "Tax amount".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to make three Dax calculated columns as follow. It goes well until my third dax code. There I get a circular dependency error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1)&lt;/P&gt;&lt;P&gt;Amount excl tax = IF('General'[Document type] = "Order", 'General'[Amount incl tax] - 'General'[Tax amount],&lt;BR /&gt;IF('General'[Document type] = "invoice", - 'General'[Tax amount]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2)&lt;BR /&gt;Tax amount = 'General'[Tax] / 10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3)&lt;BR /&gt;Amount incl tax = IF('General'[Document type] = "Order", 'General'[Amount] + 'General'[Tax amount],&lt;BR /&gt;IF('General'[Document type] = "invoice", 'General'[Amount excl tax] + 'General'[Tax amount]))&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Error: &lt;STRONG&gt;A circular dependency was detected: General[Amount excl tax], General[Amount incl tax], General[Amount excl tax]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope someone can help to see what I can do to solve the third query (or above queries to make the third query work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, Lori&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 15:27:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-circular-dependency-error-on-calculated-column/m-p/3758424#M146633</guid>
      <dc:creator>Lori001</dc:creator>
      <dc:date>2024-03-12T15:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Dax circular dependency error on calculated column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-circular-dependency-error-on-calculated-column/m-p/3758574#M146636</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="511545" data-lia-user-login="Lori001" class="lia-mention lia-mention-user"&gt;Lori001&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems in the 1st measure you refer the 3rd measure name, while in the 3rd measure, you refer the 1st measure name.&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;Do you think you can break down one of the measure instead of directly using the measure name?&lt;/P&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>Tue, 12 Mar 2024 16:35:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-circular-dependency-error-on-calculated-column/m-p/3758574#M146636</guid>
      <dc:creator>govindarajan_d</dc:creator>
      <dc:date>2024-03-12T16:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dax circular dependency error on calculated column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-circular-dependency-error-on-calculated-column/m-p/3762724#M146820</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="511545" data-lia-user-login="Lori001" class="lia-mention lia-mention-user"&gt;Lori001&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="644992" data-lia-user-login="govindarajan_d" class="lia-mention lia-mention-user"&gt;govindarajan_d&lt;/a&gt;&amp;nbsp;, I have the following additions. Based on your description and my testing, there is indeed a dependency:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;As &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="644992" data-lia-user-login="govindarajan_d" class="lia-mention lia-mention-user"&gt;govindarajan_d&lt;/a&gt;&amp;nbsp; said, your Amount excl tax column and Amount incl tax column depend on each other. Circular dependencies in Power BI can occur when two or more objects reference each other in a way that Power BI can't handle. Here are some common scenarios and solutions:&lt;BR /&gt;1. Calculated columns that reference each other: If you create two calculated columns that reference each other, a circular dependency is generated. For example, if the Line Margins are calculated from Discount PCT and the Discounted PCT is calculated from Line Margins, there is a circular dependency. The solution is to rewrite the code.&lt;BR /&gt;2. Context transformation within a calculated column: If you use COMPUTE in a calculated column, it will perform a context transformation and make the column dependent on all the columns in the table. If there are two such columns, they depend on each other, resulting in a circular dependency. The solution is to use&amp;nbsp;ALLEXCEPT or&amp;nbsp;REMOVEFILTERS and keep only the primary key of the table to limit the list of columns that the calculated column depends.&lt;BR /&gt;3. Create relationships that involve calculated columns or tables: This can also lead to hidden circular dependencies.&lt;/P&gt;
&lt;P&gt;You can click on the links below to learn more about why circular dependencies appear and why they don't work, as well as solutions to these errors:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/avoiding-circular-dependency-errors-in-dax/" target="_blank" rel="noopener"&gt;Avoiding circular dependency errors in DAX - SQLBI&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/understanding-circular-dependencies/" target="_blank" rel="noopener"&gt;Understanding circular dependencies in DAX - SQLBI&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=OFwspc_C5Xg&amp;amp;ab_channel=AsanTutorials" target="_blank" rel="noopener"&gt;https://www.youtube.com/watch?v=OFwspc_C5Xg&amp;amp;ab_channel=AsanTutorials&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Based on the DAX you provided, I rewrote your logic to avoid circular dependencies, and here are the new DAX expressions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Amount excl tax =
IF (
    'General'[Document type] = "Order",
    'General'[Amount] + 'General'[Tax amount] - 'General'[Tax amount],
    IF ( 'General'[Document type] = "invoice", - 'General'[Tax amount] )
)
&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Amount incl tax =
IF (
    'General'[Document type] = "Order",
    'General'[Amount] + 'General'[Tax amount],
    IF (
        'General'[Document type] = "invoice",
        'General'[Amount excl tax] + 'General'[Tax amount]
    )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the results:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Since the calculation column of &lt;STRONG&gt;Amount incl tax&lt;/STRONG&gt; is 'General'[Amount] + 'General'[Tax amount] when 'General'[Document type] = "Order", the above operation is performed directly in the Amount excl tax calculation column without relying on Amount incl tax.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the &lt;STRONG&gt;Amount excl tax&lt;/STRONG&gt; calculation column, if 'General'[Document type] = 'Order', then 'General'[Amount] + 'General'[Tax amount] - 'General'[Tax amount] is executed directly.&lt;/P&gt;
&lt;P&gt;I've provided the PBIX file below for this time, and it would be great if it would be helpful to you.&lt;/P&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;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-Get-Your-Question-Answered-Quickly%2Fba-p%2F38490&amp;amp;data=05%7C02%7Cv-jianpengli%40microsoft.com%7Cd9552f18a0c94a7564f308dc188bf35e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638412236574903368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=3jxUE%2BTNC8dS4DIhPphEB3NA%2BK94pwURGHu%2BXC4eezw%3D&amp;amp;reserved=0" target="_blank" rel="noopener"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Jianpeng Li&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 07:25:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-circular-dependency-error-on-calculated-column/m-p/3762724#M146820</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-20T07:25:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dax circular dependency error on calculated column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-circular-dependency-error-on-calculated-column/m-p/3779860#M147691</link>
      <description>&lt;P&gt;Hi Govind,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for this reply. It has helped!&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 14:58:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-circular-dependency-error-on-calculated-column/m-p/3779860#M147691</guid>
      <dc:creator>Lori001</dc:creator>
      <dc:date>2024-03-20T14:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Dax circular dependency error on calculated column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-circular-dependency-error-on-calculated-column/m-p/3811782#M149069</link>
      <description>&lt;P&gt;Please install previous version(2024-02). It will be no issue at all.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 18:50:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-circular-dependency-error-on-calculated-column/m-p/3811782#M149069</guid>
      <dc:creator>JamesKim</dc:creator>
      <dc:date>2024-04-04T18:50:52Z</dc:date>
    </item>
  </channel>
</rss>

