<?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: Formula execution results in Excel crash while DAX Studio works fine in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-execution-results-in-Excel-crash-while-DAX-Studio-works/m-p/1091311#M15780</link>
    <description>First off, you should never use SUMMARIZECOLUMNS in a measure since this function does not respect context transition. Then, the measure (is it a measure or just a query?) seems to me to be a bit too complex with calculations that are materialized, probably unnecessary, thus making the calculations slower than they could be.&lt;BR /&gt;&lt;BR /&gt;Secondly, what's the exact error message you get?&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
    <pubDate>Fri, 15 May 2020 09:57:12 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-05-15T09:57:12Z</dc:date>
    <item>
      <title>Formula execution results in Excel crash while DAX Studio works fine</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-execution-results-in-Excel-crash-while-DAX-Studio-works/m-p/1089894#M15720</link>
      <description>&lt;P&gt;Hi everyone.&lt;/P&gt;&lt;P&gt;I ran into the problem and I think it's because of imperfect formula.&lt;/P&gt;&lt;P&gt;I need to compute costs attributable to projects only for projects that had sales in a given period. Also, the costs should be accumulated between period of current sale and previos sale.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data model is in Russian, so I give the translation:&lt;/P&gt;&lt;P&gt;Проекты = Projects&lt;/P&gt;&lt;P&gt;Календарь[Дата] = Calendar[Date]&lt;/P&gt;&lt;P&gt;Продажи = Sales&lt;/P&gt;&lt;P&gt;[Выручка] = [SalesAmount]&lt;/P&gt;&lt;P&gt;Себестоимость = Cost Of Services Rendered&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The DAX code I've come up with:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;EVALUATE
VAR ProjectsSalesDates =
    FILTER (
        ADDCOLUMNS (
            SUMMARIZECOLUMNS ( 'Проекты'[id], 'Календарь'[Дата] ),
            "Продажи", [Выручка]
        ),
        NOT ( ISBLANK ( 'Проекты'[id] ) )
            &amp;amp;&amp;amp; [Продажи] &amp;gt; 0
    )
VAR ProjSalesPrevDates =
    ADDCOLUMNS (
        ProjectsSalesDates,
        "PrevSalesDate", MAXX (
            (
                VAR CurrProject = [id]
                VAR CurrDate = [Дата]
                VAR ProjectDates =
                    FILTER ( ProjectsSalesDates, [id] = CurrProject &amp;amp;&amp;amp; [Дата] &amp;lt; CurrDate )
                RETURN
                    ProjectDates
            ),
            [Дата]
        )
    )
VAR ProjectsCosts =
    ADDCOLUMNS (
        ProjSalesPrevDates,
        "Себестоимость трудозатрат", CALCULATE (
            [2.2. Стоимость трудозатрат],
            (
                VAR CurrDate = [Дата]
                VAR PrevDate = [PrevSalesDate]
                VAR CostPeriod =
                    DATESBETWEEN ( 'Календарь'[Дата], PrevDate, CurrDate )
                RETURN
                    CostPeriod
            )
        ),
        "Себестоимость прямых затрат", CALCULATE (
            [Прямые затраты],
            (
                VAR CurrDate = [Дата]
                VAR PrevDate = [PrevSalesDate]
                VAR CostPeriod =
                    DATESBETWEEN ( 'Календарь'[Дата], PrevDate, CurrDate )
                RETURN
                    CostPeriod
            )
        )
    )
VAR Result =
    ADDCOLUMNS (
        ProjectsCosts,
        "Себестоимость", [Себестоимость трудозатрат] + [Себестоимость прямых затрат]
    )
RETURN
    SUMX ( Result, [Себестоимость]) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;In DAX Studio is works fine and returns the following table:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;It returns 529 rows and execution time is 3250 ms.&lt;/P&gt;&lt;P&gt;But when I input this formula in Excel, it crashes :-(.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone could give me a hint, whether it's due to bad formula of something else, I'd be very grateful!&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 14:28:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-execution-results-in-Excel-crash-while-DAX-Studio-works/m-p/1089894#M15720</guid>
      <dc:creator>razmochaev</dc:creator>
      <dc:date>2020-05-14T14:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: Formula execution results in Excel crash while DAX Studio works fine</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-execution-results-in-Excel-crash-while-DAX-Studio-works/m-p/1091235#M15776</link>
      <description>&lt;P&gt;I also tested it in PowerBI and it works pretty well, but in different versions of Excel it results in a crash.&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 09:15:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-execution-results-in-Excel-crash-while-DAX-Studio-works/m-p/1091235#M15776</guid>
      <dc:creator>razmochaev</dc:creator>
      <dc:date>2020-05-15T09:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Formula execution results in Excel crash while DAX Studio works fine</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-execution-results-in-Excel-crash-while-DAX-Studio-works/m-p/1091311#M15780</link>
      <description>First off, you should never use SUMMARIZECOLUMNS in a measure since this function does not respect context transition. Then, the measure (is it a measure or just a query?) seems to me to be a bit too complex with calculations that are materialized, probably unnecessary, thus making the calculations slower than they could be.&lt;BR /&gt;&lt;BR /&gt;Secondly, what's the exact error message you get?&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
      <pubDate>Fri, 15 May 2020 09:57:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-execution-results-in-Excel-crash-while-DAX-Studio-works/m-p/1091311#M15780</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-05-15T09:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: Formula execution results in Excel crash while DAX Studio works fine</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-execution-results-in-Excel-crash-while-DAX-Studio-works/m-p/1099558#M16118</link>
      <description>&lt;P&gt;Thank you for the remarks! I've made some improvements in the formula and now it doesn't crash. Still, I didn't get the result I wanted, so I guess this topic must be closed.&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 21:35:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-execution-results-in-Excel-crash-while-DAX-Studio-works/m-p/1099558#M16118</guid>
      <dc:creator>razmochaev</dc:creator>
      <dc:date>2020-05-20T21:35:48Z</dc:date>
    </item>
  </channel>
</rss>

