<?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 Circular dependency in DAX column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-in-DAX-column/m-p/3079193#M107209</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need help with a DAX column. Originally the column worked just fine but when I added some extra logic I got an error (circular dependency).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am still trying to understand what a circular dependency is. From my knowlegde all columns in a table depend on eachother. And I think it is due to the fact that I am now calling a column in my DAX formula from the same table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since I can't share the .pbix and details from my DAX formula I will try to write down the formula without the details in it. This is the DAX formula for the DAX column, added to the table 'File'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DateMovedOutWorkingstock = 
var countofrowsinsubstatus = countrows(relatedtable('FileSubStatus'))
var countofrowsinstatus = countrows(relatedtable('FileStatus'))
var dateinworkingstock = calculate(selectedvalue(File[DateInWorkingStock])) 

return if(countofrowsinstatus = 0, dateinworkingstock, 
            if(countofrowsinsubstatus = 0, dateinworkingstock,
calculate(COALESCE(
    calculate(max('FileSubStatus'[StatusStartDate]),'FileSubStatus'[StatusId] = 3),  
    calculate(max('FileSubStatus'[StatusStartDate]),'FileSubStatus'[StatusId] = 49), 
    calculate(max('FileSubStatus'[StatusStartDate]),'FileSubStatus'[StatusId] = 48), 
    calculate(max('FileSubStatus'[StatusStartDate]),'FileSubStatus'[StatusId] = 8),  
    calculate(max('FileSubStatus'[StatusStartDate]),'FileSubStatus'[StatusId] = 11), 
    calculate(max('FileSubStatus'[StatusStartDate]),'FileSubStatus'[StatusId] = 12), 
    calculate(max('FileSubStatus'[StatusStartDate]),'FileSubStatus'[StatusId] = 66), 
    calculate(max('FileSubStatus'[StatusStartDate]),'FileSubStatus'[StatusId] = 57), 
    calculate(max('FileStatus'[StatusStartDate]), 'FileStatus'[StatusId] = 3), 
    calculate(max('FileStatus'[StatusStartDate]), 'FileStatus'[StatusId] = 49), 
    calculate(max('FileStatus'[StatusStartDate]), 'FileStatus'[StatusId] = 48), 
    calculate(max('FileStatus'[StatusStartDate]), 'FileStatus'[StatusId] = 66), 
    calculate(max('FileStatus'[StatusStartDate]), 'FileStatus'[StatusId] = 57), 
    calculate(max('FileStatus'[StatusStartDate]), 'FileStatus'[StatusId] = 61), 
    calculate(max('FileStatus'[StatusStartDate]), 'FileStatus'[StatusId] = 56), 
    calculate(max('FileStatus'[StatusStartDate]), 'FileStatus'[StatusId] = 109), 
    calculate(max('FileStatus'[StatusStartDate]), 'FileStatus'[StatusId] = 4) 
    
))))
&lt;/LI-CODE&gt;&lt;P&gt;In the table 'File' there are two columns: DateInWorkingStock and this new column&amp;nbsp;DateMovedOutWorkingstock. The purpose of these columns is to determine, based on either the FileStatus or FileSubStatus when it moved out the working stock (hope I translated this correctly to English.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When adding this column I get a circular dependency error. Anyone know what I am doing wrong here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Feb 2023 09:34:28 GMT</pubDate>
    <dc:creator>Vinnie</dc:creator>
    <dc:date>2023-02-14T09:34:28Z</dc:date>
    <item>
      <title>Circular dependency in DAX column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-in-DAX-column/m-p/3079193#M107209</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need help with a DAX column. Originally the column worked just fine but when I added some extra logic I got an error (circular dependency).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am still trying to understand what a circular dependency is. From my knowlegde all columns in a table depend on eachother. And I think it is due to the fact that I am now calling a column in my DAX formula from the same table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since I can't share the .pbix and details from my DAX formula I will try to write down the formula without the details in it. This is the DAX formula for the DAX column, added to the table 'File'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DateMovedOutWorkingstock = 
var countofrowsinsubstatus = countrows(relatedtable('FileSubStatus'))
var countofrowsinstatus = countrows(relatedtable('FileStatus'))
var dateinworkingstock = calculate(selectedvalue(File[DateInWorkingStock])) 

return if(countofrowsinstatus = 0, dateinworkingstock, 
            if(countofrowsinsubstatus = 0, dateinworkingstock,
calculate(COALESCE(
    calculate(max('FileSubStatus'[StatusStartDate]),'FileSubStatus'[StatusId] = 3),  
    calculate(max('FileSubStatus'[StatusStartDate]),'FileSubStatus'[StatusId] = 49), 
    calculate(max('FileSubStatus'[StatusStartDate]),'FileSubStatus'[StatusId] = 48), 
    calculate(max('FileSubStatus'[StatusStartDate]),'FileSubStatus'[StatusId] = 8),  
    calculate(max('FileSubStatus'[StatusStartDate]),'FileSubStatus'[StatusId] = 11), 
    calculate(max('FileSubStatus'[StatusStartDate]),'FileSubStatus'[StatusId] = 12), 
    calculate(max('FileSubStatus'[StatusStartDate]),'FileSubStatus'[StatusId] = 66), 
    calculate(max('FileSubStatus'[StatusStartDate]),'FileSubStatus'[StatusId] = 57), 
    calculate(max('FileStatus'[StatusStartDate]), 'FileStatus'[StatusId] = 3), 
    calculate(max('FileStatus'[StatusStartDate]), 'FileStatus'[StatusId] = 49), 
    calculate(max('FileStatus'[StatusStartDate]), 'FileStatus'[StatusId] = 48), 
    calculate(max('FileStatus'[StatusStartDate]), 'FileStatus'[StatusId] = 66), 
    calculate(max('FileStatus'[StatusStartDate]), 'FileStatus'[StatusId] = 57), 
    calculate(max('FileStatus'[StatusStartDate]), 'FileStatus'[StatusId] = 61), 
    calculate(max('FileStatus'[StatusStartDate]), 'FileStatus'[StatusId] = 56), 
    calculate(max('FileStatus'[StatusStartDate]), 'FileStatus'[StatusId] = 109), 
    calculate(max('FileStatus'[StatusStartDate]), 'FileStatus'[StatusId] = 4) 
    
))))
&lt;/LI-CODE&gt;&lt;P&gt;In the table 'File' there are two columns: DateInWorkingStock and this new column&amp;nbsp;DateMovedOutWorkingstock. The purpose of these columns is to determine, based on either the FileStatus or FileSubStatus when it moved out the working stock (hope I translated this correctly to English.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When adding this column I get a circular dependency error. Anyone know what I am doing wrong here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 09:34:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-in-DAX-column/m-p/3079193#M107209</guid>
      <dc:creator>Vinnie</dc:creator>
      <dc:date>2023-02-14T09:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: Circular dependency in DAX column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-in-DAX-column/m-p/3079401#M107231</link>
      <description>&lt;P&gt;I do think it might have to do with a calculated table I have in my datamodel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The exact error of the circular dependency mentions this table as well, as the 'File' table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This calculated column is a seperate table and the DAX code is as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Working stock = 

GENERATE(ALLNOBLANKROW(‘Calender Workingstock’[Date]),
CALCULATETABLE(
var measuredate = SELECTEDVALUE(‘Calender Workingstock’[Date]) 
var temptable = 
filter(File, File[DateInWorkingStock] &amp;lt;= meetdatum &amp;amp;&amp;amp;
(File[DateMovedOutWorkingStock] &amp;gt; meetdatum || isblank(File[DateMovedOutWorkingStock]))) 

return selectcolumns(temptabel, "ID File", File[id File])
)
)
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The DAX column DateMovedOutWorkingStock does not give an error when I remove this DAX table. But of course that is not a solution.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 11:52:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-in-DAX-column/m-p/3079401#M107231</guid>
      <dc:creator>Vinnie</dc:creator>
      <dc:date>2023-02-14T11:52:01Z</dc:date>
    </item>
    <item>
      <title>Re: Circular dependency in DAX column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-in-DAX-column/m-p/3081172#M107393</link>
      <description>&lt;P&gt;Please let me know if I need to provide any needed information. I would of course want to fix it but also want to understand why I am getting this error.&lt;/P&gt;&lt;P&gt;I do see now that when I remove either the 'Working stock' DAX table OR remove the relationship between the File table and the 'Working stock' table, the DAX column does not give an error.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 09:38:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-in-DAX-column/m-p/3081172#M107393</guid>
      <dc:creator>Vinnie</dc:creator>
      <dc:date>2023-02-15T09:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Circular dependency in DAX column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-in-DAX-column/m-p/3081424#M107409</link>
      <description>&lt;P&gt;I fixed this issue by adjusting the DAX statement for the DAX column&amp;nbsp;&lt;SPAN&gt;DateMovedOutWorkingStock.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I replaced&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var dateinworkingstock = calculate(selectedvalue(File[DateInWorkingStock])) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;by:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var dateinworkingstock = LOOKUPVALUE(File[DateInWorkingStock], File[ID], File[ID])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 12:37:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Circular-dependency-in-DAX-column/m-p/3081424#M107409</guid>
      <dc:creator>Vinnie</dc:creator>
      <dc:date>2023-02-15T12:37:14Z</dc:date>
    </item>
  </channel>
</rss>

