<?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: Calculate Statement - Slow Table Load with many informations in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Statement-Slow-Table-Load-with-many-informations/m-p/2903494#M94640</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343431" data-lia-user-login="ValtteriN" class="lia-mention lia-mention-user"&gt;ValtteriN&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your quick response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, I can not reach the same result with the MAX measure (in this case it would retrieve the higher fiscal period in the price list fact table) where instead I need the exact fiscal period for start the calculations.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For instance if in the price list table there is the customer "BigCompany" with item "RedItem" with fiscal period 2023004, I need to start my calculation from FY 2023004 ( &amp;gt;= related (price list[fiscalperiod]) )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Nov 2022 11:14:15 GMT</pubDate>
    <dc:creator>emarome94</dc:creator>
    <dc:date>2022-11-14T11:14:15Z</dc:date>
    <item>
      <title>Calculate Statement - Slow Table Load with many informations</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Statement-Slow-Table-Load-with-many-informations/m-p/2902293#M94568</link>
      <description>&lt;P&gt;Hi guys,&lt;BR /&gt;&lt;BR /&gt;I have created this measure (Measure1) that actually obtain the result I want to discover and gives not many problem in limited filter context like table with few rows.&amp;nbsp;&lt;BR /&gt;Measure1=&lt;BR /&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; [Measure0],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;( 'Accounting', 'Accounting'[Fiscal Period] &amp;gt;= &lt;/SPAN&gt;&lt;SPAN&gt;RELATED&lt;/SPAN&gt;&lt;SPAN&gt;( 'Price Lists'[Fiscal Period] )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;The problem comes when I add more information in the table report like customer, item, country etc. lead to a very slow loading.&amp;nbsp;&lt;BR /&gt;The expression within calculate is made by the following measure:&lt;BR /&gt;Measure0 =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt; (&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;'Price Lists'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'Price Lists'&lt;/SPAN&gt;&lt;SPAN&gt;[Old Price]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt; &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt; ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [&lt;/SPAN&gt;&lt;SPAN&gt;ASP]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;gt; &lt;/SPAN&gt;&lt;SPAN&gt;[Old Price]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ( &lt;/SPAN&gt;&lt;SPAN&gt;[ASP]&lt;/SPAN&gt;&lt;SPAN&gt; - &lt;/SPAN&gt;&lt;SPAN&gt;[Old Price]&lt;/SPAN&gt;&lt;SPAN&gt; ) * &lt;/SPAN&gt;&lt;SPAN&gt;[Quantity]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;BLANK&lt;/SPAN&gt;&lt;SPAN&gt;() ))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;From the Measure 0 I am creating a context where from the price list I am creating a table with only the values "old price" area greater than zero and then creating and then the if statement.&lt;BR /&gt;The measure 1 is using the measure 0 only where is retrieving the fiscal period from the price list with related.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me maybe with a best practice to fix the formula?&lt;BR /&gt;Really thank you in advance for your help,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;ES&lt;/P&gt;</description>
      <pubDate>Sun, 13 Nov 2022 23:15:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Statement-Slow-Table-Load-with-many-informations/m-p/2902293#M94568</guid>
      <dc:creator>emarome94</dc:creator>
      <dc:date>2022-11-13T23:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Statement - Slow Table Load with many informations</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Statement-Slow-Table-Load-with-many-informations/m-p/2902328#M94571</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;The issue is likely caused by your use of RELATED and additionally the use of complex logic within IF statement. RELATED function often suffers from performance issues and it should be avoided when possible. In your dax you use related to filter upcoming fiscal periods for calculation:&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;( 'Accounting', 'Accounting'[Fiscal Period] &amp;gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;RELATED&lt;/SPAN&gt;&lt;SPAN&gt;( 'Price Lists'[Fiscal Period] )&lt;BR /&gt;&lt;BR /&gt;The first question to ask here is if you can achieve the same calculation without using RELATED e.g. using MAX:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Measure1=&lt;BR /&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; [Measure0],&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;( 'Accounting', 'Accounting'[Fiscal Period] &amp;gt;=&amp;nbsp;MAX&lt;/SPAN&gt;&lt;SPAN&gt;( 'Price Lists'[Fiscal Period] )&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;))&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;One other thing to consider is if you need FILTER here. often you can achive the same results just by dropping it.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;e.g.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Measure1=&lt;BR /&gt;var _period =&amp;nbsp;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;( 'Price Lists'[Fiscal Period] )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; [Measure0],&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;'Accounting'[Fiscal Period] &amp;gt;= _period&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;Generally speaking avoid using RELATED and FILTER and your calculations should be faster.&lt;BR /&gt;&lt;BR /&gt;I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!&lt;BR /&gt;&lt;BR /&gt;My LinkedIn: &lt;A href="https://www.linkedin.com/in/n%C3%A4ttiahov-00001/" target="_blank"&gt;https://www.linkedin.com/in/n%C3%A4ttiahov-00001/&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 00:16:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Statement-Slow-Table-Load-with-many-informations/m-p/2902328#M94571</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2022-11-14T00:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Statement - Slow Table Load with many informations</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Statement-Slow-Table-Load-with-many-informations/m-p/2903494#M94640</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343431" data-lia-user-login="ValtteriN" class="lia-mention lia-mention-user"&gt;ValtteriN&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your quick response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, I can not reach the same result with the MAX measure (in this case it would retrieve the higher fiscal period in the price list fact table) where instead I need the exact fiscal period for start the calculations.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For instance if in the price list table there is the customer "BigCompany" with item "RedItem" with fiscal period 2023004, I need to start my calculation from FY 2023004 ( &amp;gt;= related (price list[fiscalperiod]) )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 11:14:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Statement-Slow-Table-Load-with-many-informations/m-p/2903494#M94640</guid>
      <dc:creator>emarome94</dc:creator>
      <dc:date>2022-11-14T11:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Statement - Slow Table Load with many informations</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Statement-Slow-Table-Load-with-many-informations/m-p/2903671#M94662</link>
      <description>&lt;P&gt;I see, maybe you could calculate the desired fiscal year using CALCULATE()? It is hard to provide example fitting your use case without seeign the data, but the basic idea is as follows:&lt;BR /&gt;&lt;BR /&gt;Instead of using RELATED you would use the same filter context in variable&lt;BR /&gt;var _FY =&amp;nbsp;&lt;BR /&gt;CALCULATE(MAX(&lt;SPAN&gt;&amp;nbsp;'accounting period'[Fiscal Period]), ALL(accounting period[Fiscal Period]),&amp;nbsp;'accounting period'[Fiscal Period] =MAX(&amp;nbsp;'Price Lists'[Fiscal Period]))&lt;BR /&gt;return&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; [Measure0],&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;'Accounting'[Fiscal Period] &amp;gt;= _FY&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;This dax might or might not work depending on your data, but the basic idea should function with some changes.&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 12:49:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Statement-Slow-Table-Load-with-many-informations/m-p/2903671#M94662</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2022-11-14T12:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Statement - Slow Table Load with many informations</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Statement-Slow-Table-Load-with-many-informations/m-p/2903816#M94669</link>
      <description>&lt;P&gt;Hi Again&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343431" data-lia-user-login="ValtteriN" class="lia-mention lia-mention-user"&gt;ValtteriN&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The formula looks working and in a fast way, but it show a mistake: it computes the calculation for the last value from 'Price List' "2023004" while 'accounting' fact table has arrived only at '2023003'.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried many changes like inverting this filter&amp;nbsp;&lt;SPAN&gt;'accounting period'[Fiscal Period] =MAX(&amp;nbsp;'Price Lists'[Fiscal Period]) in&amp;nbsp;'Price List'[Fiscal Period] =MAX(&amp;nbsp;'accounting'[Fiscal Period])&lt;/SPAN&gt; but no result.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Instead I found this version working (but not showing result in total)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Test = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;FY_&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;'Price List'&lt;/SPAN&gt;&lt;SPAN&gt;[Fiscal Period]&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;'Accounting'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'Accounting'&lt;/SPAN&gt;&lt;SPAN&gt;[Fiscal Period]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt;= &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Price List'&lt;/SPAN&gt;&lt;SPAN&gt;[Fiscal Period]&lt;/SPAN&gt;&lt;SPAN&gt; ) ) )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;[Measure0]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;'Accounting'&lt;/SPAN&gt;&lt;SPAN&gt;[Fiscal Period]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;gt;= &lt;/SPAN&gt;&lt;SPAN&gt;FY_&lt;/SPAN&gt;&lt;SPAN&gt; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;What do you think? Could you help me in fix the total not showing ?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;E&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 14 Nov 2022 14:13:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Statement-Slow-Table-Load-with-many-informations/m-p/2903816#M94669</guid>
      <dc:creator>emarome94</dc:creator>
      <dc:date>2022-11-14T14:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Statement - Slow Table Load with many informations</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Statement-Slow-Table-Load-with-many-informations/m-p/2903897#M94676</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Now that the issue is total not showing I would recommend checking this article by SQLBI:&lt;BR /&gt;&lt;A href="https://www.sqlbi.com/articles/obtaining-accurate-totals-in-dax/" target="_blank"&gt;Obtaining accurate totals in DAX - SQLBI&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;In short try utilizing methods such as SUMX to get the total value.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 14:42:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Statement-Slow-Table-Load-with-many-informations/m-p/2903897#M94676</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2022-11-14T14:42:07Z</dc:date>
    </item>
  </channel>
</rss>

