<?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: 'Working on it' hangs when combining multiple calculation into one column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-on-it-hangs-when-combining-multiple-calculation-into-one/m-p/2419648#M64041</link>
    <description>&lt;P&gt;Thank you for the reply! I really have a lot to learn in Power BI, most of the time I'm just using the tools I already know that do the job.&lt;BR /&gt;When trying the solution you offered I get the error "A circular dependency was detected" on Total diff column, do you have any &lt;SPAN&gt;thoughts&amp;nbsp;&lt;/SPAN&gt;on why this is happening?&lt;BR /&gt;Thanks again!&lt;/P&gt;</description>
    <pubDate>Sun, 27 Mar 2022 09:10:22 GMT</pubDate>
    <dc:creator>Yaa_D</dc:creator>
    <dc:date>2022-03-27T09:10:22Z</dc:date>
    <item>
      <title>'Working on it' hangs when combining multiple calculation into one column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-on-it-hangs-when-combining-multiple-calculation-into-one/m-p/2415122#M63777</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;BR /&gt;I have a specific calculation that works OK when seperated to different columns, but hangs when trying to combine it all into one column.&lt;BR /&gt;&lt;BR /&gt;&lt;U&gt;&lt;STRONG&gt;The specifics&lt;/STRONG&gt;&lt;/U&gt;:&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table that gets updated weekly that have the following columns: fileDate, id, total.&lt;BR /&gt;In order to get a monthly total for each id, first, I'm calclating the fileDate 4 weeks ago (previousDate).&lt;BR /&gt;To avoid 'missing' new id's, or old id's with no new activity - if the id in previousDate does not exist, I'm using the second-to-max date in which the id is found (alternateDate).&lt;BR /&gt;Finally I use this date to&amp;nbsp;LOOKUPVALUE the old total to subtract from the total for each fileDate.&lt;BR /&gt;&lt;BR /&gt;When this is seperated to two different columns as follows it works with no issues :&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;First column: determins which date to use for the id&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;.dateChoice =&lt;BR /&gt;VAR previousDate = MAXX(FILTER(ALL('table1'), 'table1'[fileDate] &amp;lt;= ('table1'[fileDate])-28), 'table1'[fileDate])&lt;BR /&gt;VAR alternateDate = CALCULATE(MAX('table1'[fileDate]), ALLEXCEPT('table1','table1'[id]),'table1'[isMaxDate] = FALSE())&lt;BR /&gt;&lt;BR /&gt;RETURN&lt;BR /&gt;IF(previousDate &amp;lt;&amp;gt; 0 , previousDate,&lt;BR /&gt;     IF(aslternateDate &amp;lt;&amp;gt; 0 , aslternateDate, 'table1'[fileDate]))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;Second colum: LOOKUPVALUE for total using the date in the first column and subtract:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;totalDiff = &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;previousTotal&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;LOOKUPVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'table1'[total]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'table1'[fileDate]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'table1'[dateChoice]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'table1'[id]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'table1'[id]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN&gt;'table1'[total]&lt;/SPAN&gt;&lt;SPAN&gt; - previousTotal&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;When I try to combine them into a single colum I get 'Working on it' stuck forever (I tried waiting 45 minuts before giving up)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;VAR&amp;nbsp;previousDate&amp;nbsp;=&amp;nbsp;MAXX(FILTER(ALL('table1'),&amp;nbsp;'table1'[fileDate]&amp;nbsp;&amp;lt;= ('table1'[fileDate])-28),&amp;nbsp;'table1'[fileDate])&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR&amp;nbsp;alternateDate&amp;nbsp;=&amp;nbsp;CALCULATE(MAX('table1'[fileDate]),&amp;nbsp;ALLEXCEPT('table1','table1'[id]),'table1'[isMaxDate]&amp;nbsp;=&amp;nbsp;FALSE())&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR&amp;nbsp;dateChoice&amp;nbsp;=&amp;nbsp;IF(previousDate&amp;nbsp;&amp;lt;&amp;gt;&amp;nbsp;0&amp;nbsp;,&amp;nbsp;previousDate,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;                    IF(alternateDate&amp;nbsp;&amp;lt;&amp;gt;&amp;nbsp;0&amp;nbsp;,&amp;nbsp;alternateDate,&amp;nbsp;'table1'[fileDate]))&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR&amp;nbsp;previousTotal&amp;nbsp;=&amp;nbsp;LOOKUPVALUE('table1'[total],'table1'[fileDate],&amp;nbsp;dateChoice,&amp;nbsp;'table1'[id],&amp;nbsp;'table1'[id])&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;RETURN&amp;nbsp;'table1'[total]&amp;nbsp;-&amp;nbsp;previousTotal&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I guess I have two questions here&lt;BR /&gt;1 - What am I missing here? Since my table already has ~80 columns I really prefer to keep this number as low as possible.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2 - Is there a way to 'cancel' when 'Working on it' hangs without killing the task? This was the first time this happened to me and it was quite painful &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you!&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 24 Mar 2022 13:19:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-on-it-hangs-when-combining-multiple-calculation-into-one/m-p/2415122#M63777</guid>
      <dc:creator>Yaa_D</dc:creator>
      <dc:date>2022-03-24T13:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: 'Working on it' hangs when combining multiple calculation into one column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-on-it-hangs-when-combining-multiple-calculation-into-one/m-p/2415220#M63782</link>
      <description>&lt;P&gt;Rather than using MAX and LOOKUPVALUE, just use TOPN&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total diff =
var currentTotal = 'table1'[total]
var currentDate = 'table1'[fileDate]
var prevTotal = SELECTCOLUMNS( TOPN(1, FILTER( ALLEXCEPT( 'table1', 'table1'[id]), 
   'table1'[fileDate] &amp;lt;= currentDate - 28 ), 'table1[fileDate], DESC), "@val", 'table1[total])
return currentTotal - prevTotal&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 24 Mar 2022 13:46:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-on-it-hangs-when-combining-multiple-calculation-into-one/m-p/2415220#M63782</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-03-24T13:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: 'Working on it' hangs when combining multiple calculation into one column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-on-it-hangs-when-combining-multiple-calculation-into-one/m-p/2419648#M64041</link>
      <description>&lt;P&gt;Thank you for the reply! I really have a lot to learn in Power BI, most of the time I'm just using the tools I already know that do the job.&lt;BR /&gt;When trying the solution you offered I get the error "A circular dependency was detected" on Total diff column, do you have any &lt;SPAN&gt;thoughts&amp;nbsp;&lt;/SPAN&gt;on why this is happening?&lt;BR /&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Sun, 27 Mar 2022 09:10:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-on-it-hangs-when-combining-multiple-calculation-into-one/m-p/2419648#M64041</guid>
      <dc:creator>Yaa_D</dc:creator>
      <dc:date>2022-03-27T09:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: 'Working on it' hangs when combining multiple calculation into one column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-on-it-hangs-when-combining-multiple-calculation-into-one/m-p/2420870#M64122</link>
      <description>&lt;P&gt;its possible that the column itself is being included in the TOPN calculations, try replacing that line with&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var prevTotal = SELECTCOLUMNS( TOPN(1, SELECTCOLUMNS(
   FILTER( ALLEXCEPT( 'table1', 'table1'[id]), 
   'table1'[fileDate] &amp;lt;= currentDate - 28 ), 
   "@fileDate", 'table1[fileDate], "@value", 'table1[total])
@fileDate, DESC), "@val", [@value])&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 28 Mar 2022 08:35:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Working-on-it-hangs-when-combining-multiple-calculation-into-one/m-p/2420870#M64122</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-03-28T08:35:47Z</dc:date>
    </item>
  </channel>
</rss>

