<?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 Nested SUMMARIZE: how to access column added to inner SUMMARIZE in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-SUMMARIZE-how-to-access-column-added-to-inner-SUMMARIZE/m-p/2672890#M79770</link>
    <description>&lt;P&gt;I cannot seem to get nested SUMMARIZE working.&lt;/P&gt;&lt;P&gt;I have this measure below, which is working correctly. It give me a flag called _Missing, at (Org, Month) level, which indicates if any sales data is missing for that month.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MyMeasure = 
        SUMX(
            CALCULATETABLE(
                ADDCOLUMNS(
                    CROSSJOIN(VALUES('Organisation'[OrgCode]), VALUES('DimDate'[YYYYMM]))
                    ,"_Missing", IF(ISBLANK([Sales]), 1, 0)
                    ,"_OrdQty", [OrdQty]
                    ,"_OrdValue", [OrdQty]
                )
                ,ALL('DimDate')
            )
            ,[_Missing]
        )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Now what I want to do is get the sum of that _Missing flag at Org level. My intension is for my measure to only returns a value for those orgs that have no missing months i.e. have _Missing = 0 at (Org) level.&lt;/P&gt;&lt;P&gt;I tried this measure below:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MyMeasure =
        SUMX(
            SUMMARIZE(
                CALCULATETABLE(
                    ADDCOLUMNS(
                        CROSSJOIN(VALUES('Organisation'[OrgCode]), VALUES('DimDate'[YYYYMM]))
                        ,"_Missing", IF(ISBLANK([Sales]), 1, 0)
                        ,"_OrdQty", [OrdQty]
                        ,"_OrdValue", [OrdQty]
                    )
                    ,ALL('DimDate')
                )
                ,'Organisation'[OrgCode]
                ,"_MissingOrgLevel", SUM([_Missing])
            )
            ,[_MissingOrgLevel]
        )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it generates this error:&lt;/P&gt;&lt;P&gt;'_MissingOrgLevel' cannot be found or may not be used in this expression.&lt;/P&gt;&lt;P&gt;Any ideas how to achieve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Aug 2022 12:22:31 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-08-01T12:22:31Z</dc:date>
    <item>
      <title>Nested SUMMARIZE: how to access column added to inner SUMMARIZE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-SUMMARIZE-how-to-access-column-added-to-inner-SUMMARIZE/m-p/2672890#M79770</link>
      <description>&lt;P&gt;I cannot seem to get nested SUMMARIZE working.&lt;/P&gt;&lt;P&gt;I have this measure below, which is working correctly. It give me a flag called _Missing, at (Org, Month) level, which indicates if any sales data is missing for that month.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MyMeasure = 
        SUMX(
            CALCULATETABLE(
                ADDCOLUMNS(
                    CROSSJOIN(VALUES('Organisation'[OrgCode]), VALUES('DimDate'[YYYYMM]))
                    ,"_Missing", IF(ISBLANK([Sales]), 1, 0)
                    ,"_OrdQty", [OrdQty]
                    ,"_OrdValue", [OrdQty]
                )
                ,ALL('DimDate')
            )
            ,[_Missing]
        )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Now what I want to do is get the sum of that _Missing flag at Org level. My intension is for my measure to only returns a value for those orgs that have no missing months i.e. have _Missing = 0 at (Org) level.&lt;/P&gt;&lt;P&gt;I tried this measure below:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MyMeasure =
        SUMX(
            SUMMARIZE(
                CALCULATETABLE(
                    ADDCOLUMNS(
                        CROSSJOIN(VALUES('Organisation'[OrgCode]), VALUES('DimDate'[YYYYMM]))
                        ,"_Missing", IF(ISBLANK([Sales]), 1, 0)
                        ,"_OrdQty", [OrdQty]
                        ,"_OrdValue", [OrdQty]
                    )
                    ,ALL('DimDate')
                )
                ,'Organisation'[OrgCode]
                ,"_MissingOrgLevel", SUM([_Missing])
            )
            ,[_MissingOrgLevel]
        )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it generates this error:&lt;/P&gt;&lt;P&gt;'_MissingOrgLevel' cannot be found or may not be used in this expression.&lt;/P&gt;&lt;P&gt;Any ideas how to achieve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 12:22:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-SUMMARIZE-how-to-access-column-added-to-inner-SUMMARIZE/m-p/2672890#M79770</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-01T12:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Nested SUMMARIZE: how to access column added to inner SUMMARIZE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-SUMMARIZE-how-to-access-column-added-to-inner-SUMMARIZE/m-p/2672972#M79774</link>
      <description>&lt;P&gt;try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MyMeasure =
SUMX (
    ADDCOLUMNS (
        SUMMARIZE (
            CALCULATETABLE (
                ADDCOLUMNS (
                    CROSSJOIN ( VALUES ( 'Organisation'[OrgCode] ), VALUES ( 'DimDate'[YYYYMM] ) ),
                    "_Missing", IF ( ISBLANK ( [Sales] ), 1, 0 ),
                    "_OrdQty", [OrdQty],
                    "_OrdValue", [OrdQty]
                ),
                ALL ( 'DimDate' )
            ),
            'Organisation'[OrgCode]
        ),
        "_MissingOrgLevel", SUM ( [_Missing] )
    ),
    [_MissingOrgLevel]
)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 01 Aug 2022 12:55:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-SUMMARIZE-how-to-access-column-added-to-inner-SUMMARIZE/m-p/2672972#M79774</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-08-01T12:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: Nested SUMMARIZE: how to access column added to inner SUMMARIZE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-SUMMARIZE-how-to-access-column-added-to-inner-SUMMARIZE/m-p/2673252#M79787</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240987" data-lia-user-login="johnt75" class="lia-mention lia-mention-user"&gt;johnt75&lt;/a&gt;&amp;nbsp;thanks for the suggerstion, but unfortunately it gives a similar error, this time for the calculated column [_Missing]:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Column '_Missing' cannot be found or may not be used in this expression.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 14:34:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-SUMMARIZE-how-to-access-column-added-to-inner-SUMMARIZE/m-p/2673252#M79787</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-01T14:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: Nested SUMMARIZE: how to access column added to inner SUMMARIZE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-SUMMARIZE-how-to-access-column-added-to-inner-SUMMARIZE/m-p/2673453#M79802</link>
      <description>&lt;P&gt;Storing the table in a variable may help&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MyMeasure =
VAR generatedTable =
    CALCULATETABLE (
        ADDCOLUMNS (
            CROSSJOIN ( VALUES ( 'Organisation'[OrgCode] ), VALUES ( 'DimDate'[YYYYMM] ) ),
            "_Missing", IF ( ISBLANK ( [Sales] ), 1, 0 ),
            "_OrdQty", [OrdQty],
            "_OrdValue", [OrdQty]
        ),
        ALL ( 'DimDate' )
    )
RETURN
    SUMX (
        ADDCOLUMNS (
            SUMMARIZE ( generatedTable, 'Organisation'[OrgCode] ),
            "_MissingOrgLevel", SUMX ( generatedTable, [_Missing] )
        ),
        [_MissingOrgLevel]
    )&lt;/LI-CODE&gt;&lt;P&gt;BTW, both _OrdQty and _OrdValue use the same measure&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 15:56:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-SUMMARIZE-how-to-access-column-added-to-inner-SUMMARIZE/m-p/2673453#M79802</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-08-01T15:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Nested SUMMARIZE: how to access column added to inner SUMMARIZE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-SUMMARIZE-how-to-access-column-added-to-inner-SUMMARIZE/m-p/2673454#M79803</link>
      <description>&lt;P&gt;I have cracked it. I need to create a second measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MissingMonths = 
    SUMX(
        CALCULATETABLE (
            ADDCOLUMNS (
                CROSSJOIN ( VALUES ( 'Org'[Code] ), VALUES ( 'DimDate'[YYYYMM])),
                "_Missing", IF ( ISBLANK ( [Sales] ), 1, 0 )
            ),
            ALL ( 'DimDate' ),
        )
        ,[_Missing]
    )&lt;/LI-CODE&gt;&lt;P&gt;and then for the Org level, the measure is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MyMeasure =
    SUMX(
        VALUES ( 'Org'[Code] )
        , IF([MissingMonths] = 0, [Sales])
    )&lt;/LI-CODE&gt;&lt;P&gt;This returns the total Sales for only those Orgs that do not have any missing months.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 15:57:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-SUMMARIZE-how-to-access-column-added-to-inner-SUMMARIZE/m-p/2673454#M79803</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-01T15:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: Nested SUMMARIZE: how to access column added to inner SUMMARIZE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-SUMMARIZE-how-to-access-column-added-to-inner-SUMMARIZE/m-p/2674769#M79870</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&amp;nbsp;, that does allow me to access the [_MissingOrgLevel] column, which is what I was after.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But something is not working correctly. The line&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"_MissingOrgLevel", SUMX ( generatedTable, [_Missing] )&lt;/LI-CODE&gt;&lt;P&gt;does not seem to honour the OrgCode; the line seems to always give the sum of [_Missing] for the entire generatedTable, for every row of the SUMMARIZE.&lt;/P&gt;&lt;P&gt;For example, when I select just one OrgCode which has missing months, then the measure returns 1 as expected. And when I select just onw OrgCode which had zero missing months, then the measure returns 0 as expected.&lt;/P&gt;&lt;P&gt;But when I select both of those two OrgCodes, I want the measure to return 1; but it returns 2.&lt;/P&gt;&lt;P&gt;And if I select 9 OrgCodes that have zero missing months plus one OrgCode that does have missing months, it returns 10.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240987" data-lia-user-login="johnt75" class="lia-mention lia-mention-user"&gt;johnt75&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 07:43:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-SUMMARIZE-how-to-access-column-added-to-inner-SUMMARIZE/m-p/2674769#M79870</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-02T07:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: Nested SUMMARIZE: how to access column added to inner SUMMARIZE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-SUMMARIZE-how-to-access-column-added-to-inner-SUMMARIZE/m-p/2674821#M79874</link>
      <description>&lt;P&gt;change it to&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"_MissingOrgLevel", CALCULATE( SUMX ( generatedTable, [_Missing] ) )&lt;/LI-CODE&gt;&lt;P&gt;that will force it to pick up the org during context transition&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 07:59:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-SUMMARIZE-how-to-access-column-added-to-inner-SUMMARIZE/m-p/2674821#M79874</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-08-02T07:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Nested SUMMARIZE: how to access column added to inner SUMMARIZE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-SUMMARIZE-how-to-access-column-added-to-inner-SUMMARIZE/m-p/2674907#M79876</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240987" data-lia-user-login="johnt75" class="lia-mention lia-mention-user"&gt;johnt75&lt;/a&gt;&amp;nbsp;, wrapping it in a CALCULATE did not work. I tried this in the second half of the measure&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    RETURN
        CONCATENATEX( 
            SUMMARIZE ( generatedTable, 'Organisation'[OrgCode] ),
            'Organisation'[OrgCode] &amp;amp; "(" &amp;amp; CALCULATE(SUMX(generatedTable, [_Missing])) &amp;amp; ")",
            ","
        )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the results when I select three Orgs (0702, 0703, 0140) are below. Notice how the Total row shows all three Orgs with the same SUM of 26 for _Missing.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have got it working by using a FILTER on the table variable like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    RETURN
        CONCATENATEX( 
            SUMMARIZE ( generatedTable, 'Organisation'[OrgCode] ),
            VAR vOrgCode = 'Organisation'[OrgCode]
            RETURN
              'Organisation'[OrgCode] &amp;amp; "(" &amp;amp; SUMX(FILTER(generatedTable, 'Organisation'[OrgCode] = vOrgCode), [_Missing]) &amp;amp; ")",
            ","
        )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which gives these correct results:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks very much for your help,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240987" data-lia-user-login="johnt75" class="lia-mention lia-mention-user"&gt;johnt75&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 08:31:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Nested-SUMMARIZE-how-to-access-column-added-to-inner-SUMMARIZE/m-p/2674907#M79876</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-02T08:31:54Z</dc:date>
    </item>
  </channel>
</rss>

