<?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 Avoid skipping empty rows when SUMMARIZE table with zero records in the source in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Avoid-skipping-empty-rows-when-SUMMARIZE-table-with-zero-records/m-p/3805480#M148795</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using DAX I am trying to execute following sequece:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;FILTER the records from table BusinessCases according to the conditions&lt;/LI&gt;&lt;LI&gt;SUMMARIZE the filtered records by weeks (there is a relation between SalesCases[Date] and Calendar[Date], Calendar[Week number])&lt;/LI&gt;&lt;LI&gt;Calculate AVERAGE of the SUMMARIZED weekly sums&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I have following DAX Measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Average weekly business won volume = 
AVERAGEX(
    SUMMARIZE(
        FILTER(
            BusinessCases,
            BusinessCases[Status] = "Won" &amp;amp;&amp;amp;
            BusinessCases[Date type] = "Closed"
        ),
        Calendar[Week number],
        "SummarizedResult", SUMX(BusinessCases, BusinessCases[Ammount])
    ),
    [SummarizedResult]
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The measure works fine when there are records in the BusinessCases table meeting the filtering conditions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when there are no records meeting the conditions, the result of the SUMMARIZE function does not contain the specific week number at all which distorts the result of the AVERAGEX function then.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example: assuming in week number 2 there are no records in BusinessCases table meeting conditions&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;current behaviour:&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Week number&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;SummarizedResult&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;6000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;4000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;&lt;EM&gt;Weekly average&lt;/EM&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;&lt;EM&gt;4000&lt;/EM&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;desired behaviour:&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Week number&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;SummarizedResult&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;6000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;2&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;4000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;&lt;EM&gt;Weekly average&lt;/EM&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&lt;EM&gt;3000&lt;/EM&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Could you please help me to adjust the DAX formula above to change the behaviour that instead of skipping the weeks with empty records input, the 0 value for the specific week is returned to enable proper AVERAGE calculation?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jakub Albrecht&lt;/P&gt;</description>
    <pubDate>Tue, 02 Apr 2024 20:45:28 GMT</pubDate>
    <dc:creator>jakubalbrecht</dc:creator>
    <dc:date>2024-04-02T20:45:28Z</dc:date>
    <item>
      <title>Avoid skipping empty rows when SUMMARIZE table with zero records in the source</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Avoid-skipping-empty-rows-when-SUMMARIZE-table-with-zero-records/m-p/3805480#M148795</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using DAX I am trying to execute following sequece:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;FILTER the records from table BusinessCases according to the conditions&lt;/LI&gt;&lt;LI&gt;SUMMARIZE the filtered records by weeks (there is a relation between SalesCases[Date] and Calendar[Date], Calendar[Week number])&lt;/LI&gt;&lt;LI&gt;Calculate AVERAGE of the SUMMARIZED weekly sums&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I have following DAX Measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Average weekly business won volume = 
AVERAGEX(
    SUMMARIZE(
        FILTER(
            BusinessCases,
            BusinessCases[Status] = "Won" &amp;amp;&amp;amp;
            BusinessCases[Date type] = "Closed"
        ),
        Calendar[Week number],
        "SummarizedResult", SUMX(BusinessCases, BusinessCases[Ammount])
    ),
    [SummarizedResult]
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The measure works fine when there are records in the BusinessCases table meeting the filtering conditions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when there are no records meeting the conditions, the result of the SUMMARIZE function does not contain the specific week number at all which distorts the result of the AVERAGEX function then.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example: assuming in week number 2 there are no records in BusinessCases table meeting conditions&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;current behaviour:&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Week number&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;SummarizedResult&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;6000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;4000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;&lt;EM&gt;Weekly average&lt;/EM&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;&lt;EM&gt;4000&lt;/EM&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;desired behaviour:&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Week number&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;SummarizedResult&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;6000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;2&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;0&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;4000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;&lt;EM&gt;Weekly average&lt;/EM&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&lt;EM&gt;3000&lt;/EM&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Could you please help me to adjust the DAX formula above to change the behaviour that instead of skipping the weeks with empty records input, the 0 value for the specific week is returned to enable proper AVERAGE calculation?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jakub Albrecht&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2024 20:45:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Avoid-skipping-empty-rows-when-SUMMARIZE-table-with-zero-records/m-p/3805480#M148795</guid>
      <dc:creator>jakubalbrecht</dc:creator>
      <dc:date>2024-04-02T20:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: Avoid skipping empty rows when SUMMARIZE table with zero records in the source</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Avoid-skipping-empty-rows-when-SUMMARIZE-table-with-zero-records/m-p/3805671#M148804</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="443534" data-lia-user-login="jakubalbrecht" class="lia-mention lia-mention-user"&gt;jakubalbrecht&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please try&lt;/P&gt;
&lt;P&gt;Average weekly business won volume =&lt;BR /&gt;AVERAGEX (&lt;BR /&gt;SUMMARIZE (&lt;BR /&gt;FILTER (&lt;BR /&gt;BusinessCases,&lt;BR /&gt;BusinessCases[Status] = "Won"&lt;BR /&gt;&amp;amp;&amp;amp; BusinessCases[Date type] = "Closed"&lt;BR /&gt;),&lt;BR /&gt;Calendar[Week number],&lt;BR /&gt;"SummarizedResult", SUMX ( BusinessCases, BusinessCases[Ammount] )&lt;BR /&gt;),&lt;BR /&gt;[SummarizedResult] + 0&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2024 18:39:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Avoid-skipping-empty-rows-when-SUMMARIZE-table-with-zero-records/m-p/3805671#M148804</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2024-04-02T18:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: Avoid skipping empty rows when SUMMARIZE table with zero records in the source</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Avoid-skipping-empty-rows-when-SUMMARIZE-table-with-zero-records/m-p/3805883#M148815</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&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;thank you for your suggestion. These were my first ideas of the solution too, but unfortunately this does not work &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suggested solution adds 0 to every single row generated by the SUMMARIZE function, but unfortunately does not force SUMMARIZE function to avoid ommiting rows for weeks with no records.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I use my example, the suggested solution results in following - week number 2 still missing:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Week number&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;SummarizedResult&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;6000 + 0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;4000 + 0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;2000 + 0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;&lt;EM&gt;Weekly average&lt;/EM&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;&lt;EM&gt;4000&lt;/EM&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 02 Apr 2024 20:41:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Avoid-skipping-empty-rows-when-SUMMARIZE-table-with-zero-records/m-p/3805883#M148815</guid>
      <dc:creator>jakubalbrecht</dc:creator>
      <dc:date>2024-04-02T20:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Avoid skipping empty rows when SUMMARIZE table with zero records in the source</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Avoid-skipping-empty-rows-when-SUMMARIZE-table-with-zero-records/m-p/3806001#M148826</link>
      <description>&lt;P&gt;I would start with a full set of weeks and then calculate amount along these lines:&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Average weekly business won volume =
VAR _FullWeeks_ = VALUES ( Calendar[Week number] )
VAR _Avg =
    AVERAGEX (
        _FullWeeks_,
        CALCULATE (
            SUM ( BusinessCases[Ammount] ),
            BusinessCases[Status] = "Won",
            BusinessCases[Date type] = "Closed"
        ) + 0
    )
RETURN
    _Avg&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might need something more sophisticated for _FullWeeks_ as I'm not sure how the min and max week numbers are determined in your scenario.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2024 21:54:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Avoid-skipping-empty-rows-when-SUMMARIZE-table-with-zero-records/m-p/3806001#M148826</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2024-04-02T21:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: Avoid skipping empty rows when SUMMARIZE table with zero records in the source</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Avoid-skipping-empty-rows-when-SUMMARIZE-table-with-zero-records/m-p/3806018#M148828</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="443534" data-lia-user-login="jakubalbrecht" class="lia-mention lia-mention-user"&gt;jakubalbrecht&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Average weekly business won volume =&lt;BR /&gt;AVERAGEX (&lt;BR /&gt;VALUES ( Calendar[Week number] ),&lt;BR /&gt;CALCULATE (&lt;BR /&gt;SUM ( BusinessCases[Ammount] ),&lt;BR /&gt;FILTER (&lt;BR /&gt;BusinessCases,&lt;BR /&gt;BusinessCases[Status] = "Won"&lt;BR /&gt;&amp;amp;&amp;amp; BusinessCases[Date type] = "Closed"&lt;BR /&gt;)&lt;BR /&gt;) + 0&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2024 22:07:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Avoid-skipping-empty-rows-when-SUMMARIZE-table-with-zero-records/m-p/3806018#M148828</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2024-04-02T22:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Avoid skipping empty rows when SUMMARIZE table with zero records in the source</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Avoid-skipping-empty-rows-when-SUMMARIZE-table-with-zero-records/m-p/3807122#M148848</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&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;, thank you very much for the update. We are pretty close - for every single week the calculation works as expected (incl. 0 values instead of skipped rows) but the final average return the sum of the weekly values instead of average values.&lt;BR /&gt;&lt;BR /&gt;But modificated solution provided by&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="39298" data-lia-user-login="AlexisOlson" class="lia-mention lia-mention-user"&gt;AlexisOlson&lt;/a&gt;&amp;nbsp;bellow (ommited FILTER function) works perpectly.&lt;BR /&gt;&lt;BR /&gt;Thank you very much to both of you!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2024 08:23:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Avoid-skipping-empty-rows-when-SUMMARIZE-table-with-zero-records/m-p/3807122#M148848</guid>
      <dc:creator>jakubalbrecht</dc:creator>
      <dc:date>2024-04-03T08:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: Avoid skipping empty rows when SUMMARIZE table with zero records in the source</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Avoid-skipping-empty-rows-when-SUMMARIZE-table-with-zero-records/m-p/3807123#M148849</link>
      <description>&lt;P&gt;Thank you,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="39298" data-lia-user-login="AlexisOlson" class="lia-mention lia-mention-user"&gt;AlexisOlson&lt;/a&gt;&amp;nbsp;, works perfectly.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2024 08:24:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Avoid-skipping-empty-rows-when-SUMMARIZE-table-with-zero-records/m-p/3807123#M148849</guid>
      <dc:creator>jakubalbrecht</dc:creator>
      <dc:date>2024-04-03T08:24:28Z</dc:date>
    </item>
  </channel>
</rss>

