<?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: Incorrect result with nested measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-result-with-nested-measure/m-p/2579136#M73949</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="132246" data-lia-user-login="jct999" class="lia-mention lia-mention-user"&gt;jct999&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please modify the IMPORTER_MARKET_ACTUAL_CY_MTD.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;IMPORTER_MARKET_ACTUAL_CY_MTD :=
VAR cy = 2022
VAR cm = 4
VAR r =
    CALCULATE (
        [IMPORTER_MARKET_ACTUAL],
        FILTER ( ALL ( DATASET ), 'DATASET'[YEAR] = cy &amp;amp;&amp;amp; 'DATASET'[MONTH] &amp;lt;= cm )
    )
RETURN
    r
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I have misunderstood your meaning, please provide some sample data without privacy information and desired output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ Polly&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jun 2022 09:32:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-06-22T09:32:38Z</dc:date>
    <item>
      <title>Incorrect result with nested measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-result-with-nested-measure/m-p/2554326#M72426</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 2 measures :&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;IMPORTER_MARKET_ACTUAL&lt;/LI&gt;&lt;LI&gt;IMPORTER_MARKET_ACTUAL_CY_MTD that references IMPORTER_MARKET_ACTUAL. The purpose of this 2nd measure is to restrict the time scope of the first measure.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Problem : The 2nd measure is not computed correctly. Time criterias seem not to be applied to the nested measure&amp;nbsp;IMPORTER_MARKET_ACTUAL.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Can any one help me to understand where is the issue ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;IMPORTER_MARKET_ACTUAL :=&lt;BR /&gt;SUMX (&lt;BR /&gt;     VALUES ( 'COUNTRY'[COUNTRY] );&lt;BR /&gt;     VAR registration =&lt;BR /&gt;          SUMX (&lt;BR /&gt;               CALCULATETABLE (&lt;BR /&gt;                   'DATASET';&lt;BR /&gt;                   'DATASET'[KPI_TYPE] = "REGISTRATION";&lt;BR /&gt;                   'DATASET'[KPI_NATURE] = "ACTUAL";&lt;BR /&gt;                   IMPORTER[IMPORTER] = "I"&lt;BR /&gt;               );&lt;BR /&gt;               'DATASET'[VOLUME]&lt;BR /&gt;         )&lt;BR /&gt;VAR market =&lt;BR /&gt;          SUMX (&lt;BR /&gt;               CALCULATETABLE (&lt;BR /&gt;                    'DATASET';&lt;BR /&gt;                    'DATASET'[KPI_TYPE] = "MARKET";&lt;BR /&gt;                    'DATASET'[KPI_NATURE] = "ACTUAL";&lt;BR /&gt;                    ALL ( 'DATASET'[BRAND] );&lt;BR /&gt;                    ALL ( IMPORTER )&lt;BR /&gt;               );&lt;BR /&gt;               'DATASET'[VOLUME]&lt;BR /&gt;          )&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;     IF ( registration &amp;gt; 0; market; BLANK () )&lt;/PRE&gt;&lt;P&gt;It returns 16 744 921&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;!--  StartFragment   --&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;IMPORTER_MARKET_ACTUAL_CY_MTD :=&lt;BR /&gt;&lt;/SPAN&gt;VAR &lt;SPAN class=""&gt;cy&lt;/SPAN&gt;&lt;SPAN class=""&gt; = 2022&lt;BR /&gt;&lt;SPAN class=""&gt;VAR&lt;/SPAN&gt; &lt;SPAN class=""&gt;cm&lt;/SPAN&gt;&lt;SPAN class=""&gt; = 4&lt;BR /&gt;&lt;/SPAN&gt;VAR r =&amp;nbsp;&lt;SPAN class=""&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;[IMPORTER_MARKET_ACTUAL];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;'DATASET'[YEAR] = &lt;/SPAN&gt;&lt;SPAN class=""&gt;cy&lt;/SPAN&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;'DATASET'[MONTH] &amp;lt;= &lt;/SPAN&gt;&lt;SPAN class=""&gt;cm&lt;BR /&gt;RETURN r&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;It returns 16 744 921. It is incorrect, it should return 1 541 374...&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2022 06:05:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-result-with-nested-measure/m-p/2554326#M72426</guid>
      <dc:creator>jct999</dc:creator>
      <dc:date>2022-06-02T06:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect result with nested measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-result-with-nested-measure/m-p/2554812#M72468</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="132246" data-lia-user-login="jct999" class="lia-mention lia-mention-user"&gt;jct999&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Just use a date table and all will be as you wish.&lt;/P&gt;&lt;P&gt;You may try adding REMOVFILTERS ( DATASET ) to 2nd Measure CALCULATE but I don't think it is going to work properly.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2022 08:58:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-result-with-nested-measure/m-p/2554812#M72468</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-02T08:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect result with nested measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-result-with-nested-measure/m-p/2554910#M72481</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply,&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure that adding a Date table to the model will solve the problem, because the YEAR and MONTH columns are not strictly speaking time dimensions for the model. They could be replaced by other things, such as WEIGHT and SIZE... and the problem remain the same.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Using REMOVEFILTERS will remove all the outer filters that are applied in the visual (i.e on DATASET[COLOR], DATASET[PRICE_CATEGORY] ... etc), and it will produce incorrect results&lt;BR /&gt;&lt;BR /&gt;It seems that the filters applied in the 2nd measures are not propagated within the nested measure (1st measure) ;&amp;nbsp;and I dont't understand why... May be because :&amp;nbsp;&lt;BR /&gt;- Filters in 2nd measure are not propagated into the VAR in the 1st measure ... ?&lt;/P&gt;&lt;P&gt;- There are to much nested calculations in the 1st measure : SUMX( SUMX ( CALCULATETABLE ( ... ) ) ... ?&lt;/P&gt;&lt;P&gt;- Context transition or iterator issue/&lt;SPAN&gt;poor understanding&lt;/SPAN&gt;&amp;nbsp;... ?&lt;BR /&gt;&lt;BR /&gt;DAX is complex to use !&lt;BR /&gt;Need help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2022 09:40:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-result-with-nested-measure/m-p/2554910#M72481</guid>
      <dc:creator>jct999</dc:creator>
      <dc:date>2022-06-02T09:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect result with nested measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-result-with-nested-measure/m-p/2554920#M72483</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="132246" data-lia-user-login="jct999" class="lia-mention lia-mention-user"&gt;jct999&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;you need to read about Autoexist. Long story short, you need a date table. Just a simple one with date, year and month.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2022 09:38:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-result-with-nested-measure/m-p/2554920#M72483</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-02T09:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect result with nested measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-result-with-nested-measure/m-p/2579136#M73949</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="132246" data-lia-user-login="jct999" class="lia-mention lia-mention-user"&gt;jct999&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please modify the IMPORTER_MARKET_ACTUAL_CY_MTD.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;IMPORTER_MARKET_ACTUAL_CY_MTD :=
VAR cy = 2022
VAR cm = 4
VAR r =
    CALCULATE (
        [IMPORTER_MARKET_ACTUAL],
        FILTER ( ALL ( DATASET ), 'DATASET'[YEAR] = cy &amp;amp;&amp;amp; 'DATASET'[MONTH] &amp;lt;= cm )
    )
RETURN
    r
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I have misunderstood your meaning, please provide some sample data without privacy information and desired output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ Polly&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 09:32:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Incorrect-result-with-nested-measure/m-p/2579136#M73949</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-22T09:32:38Z</dc:date>
    </item>
  </channel>
</rss>

