<?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 Calculating the daily average of the displayed range when some dates have no data. in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-daily-average-of-the-displayed-range-when-some/m-p/2919573#M95712</link>
    <description>&lt;P&gt;Hi folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a simple matrix visual showing the daily total of some production metric grouped per categories; I use a slicer to select any date range; some categories have data all days, while others don't. I want to get the average for the displayed range in the visual, no matter if the column has values for all rows; so if I'm displaying 7 days, all totals should be divided by 7. Cannot get that to work and always get the average of the existing rows in each category; so if all rows have data the result is correct (green circles), but if some date has no production, the result is wonrg (red circle). Any suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AVG = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AVERAGEX&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;KEEPFILTERS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Table'[Día Operativo]&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;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Table'[Product]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and regards.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 21 Nov 2022 18:32:58 GMT</pubDate>
    <dc:creator>Trostis</dc:creator>
    <dc:date>2022-11-21T18:32:58Z</dc:date>
    <item>
      <title>Calculating the daily average of the displayed range when some dates have no data.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-daily-average-of-the-displayed-range-when-some/m-p/2919573#M95712</link>
      <description>&lt;P&gt;Hi folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a simple matrix visual showing the daily total of some production metric grouped per categories; I use a slicer to select any date range; some categories have data all days, while others don't. I want to get the average for the displayed range in the visual, no matter if the column has values for all rows; so if I'm displaying 7 days, all totals should be divided by 7. Cannot get that to work and always get the average of the existing rows in each category; so if all rows have data the result is correct (green circles), but if some date has no production, the result is wonrg (red circle). Any suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AVG = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AVERAGEX&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;KEEPFILTERS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Table'[Día Operativo]&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;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Table'[Product]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and regards.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 18:32:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-daily-average-of-the-displayed-range-when-some/m-p/2919573#M95712</guid>
      <dc:creator>Trostis</dc:creator>
      <dc:date>2022-11-21T18:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the daily average of the displayed range when some dates have no data.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-daily-average-of-the-displayed-range-when-some/m-p/2919675#M95723</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="475269" data-lia-user-login="Trostis" class="lia-mention lia-mention-user"&gt;Trostis&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please try&lt;/P&gt;
&lt;P&gt;AVG =&lt;BR /&gt;AVERAGEX (&lt;BR /&gt;KEEPFILTERS ( VALUES ( 'Table'[Día Operativo] ) ),&lt;BR /&gt;COALESCE ( CALCULATE ( SUM ( 'Table'[Product] ) ), 0 )&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 19:58:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-daily-average-of-the-displayed-range-when-some/m-p/2919675#M95723</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-11-21T19:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the daily average of the displayed range when some dates have no data.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-daily-average-of-the-displayed-range-when-some/m-p/2922017#M95837</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thanks&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.powerbi.com/t5/user/viewprofilepage/user-id/317289" target="_blank"&gt;@tamerj1&lt;/A&gt;&lt;SPAN&gt;, but no luck...same result. No changes at all that I can see when applying your recommendation. Regards.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 14:44:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-daily-average-of-the-displayed-range-when-some/m-p/2922017#M95837</guid>
      <dc:creator>Trostis</dc:creator>
      <dc:date>2022-11-22T14:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the daily average of the displayed range when some dates have no data.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-daily-average-of-the-displayed-range-when-some/m-p/2922084#M95842</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="475269" data-lia-user-login="Trostis" class="lia-mention lia-mention-user"&gt;Trostis&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please use&lt;/P&gt;
&lt;P&gt;AVG =&lt;BR /&gt;AVERAGEX (&lt;BR /&gt;KEEPFILTERS (&lt;BR /&gt;CALCULATETABLE ( VALUES ( 'Table'[Día Operativo] ), ALL ( 'Table'[Category] ) )&lt;BR /&gt;),&lt;BR /&gt;COALESCE ( CALCULATE ( SUM ( 'Table'[Product] ) ), 0 )&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 15:00:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-daily-average-of-the-displayed-range-when-some/m-p/2922084#M95842</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-11-22T15:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the daily average of the displayed range when some dates have no data.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-daily-average-of-the-displayed-range-when-some/m-p/2922112#M95844</link>
      <description>&lt;P&gt;Excellent!!! That did work as I needed it!!! Now I'm exceeding myself with this, I know, but &lt;EM&gt;what the heck&lt;/EM&gt; is that expression doing? At least the new CALCULATETABLE part...again, really appreciate your help. Regards.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 15:19:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-daily-average-of-the-displayed-range-when-some/m-p/2922112#M95844</guid>
      <dc:creator>Trostis</dc:creator>
      <dc:date>2022-11-22T15:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the daily average of the displayed range when some dates have no data.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-daily-average-of-the-displayed-range-when-some/m-p/2922172#M95851</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="475269" data-lia-user-login="Trostis" class="lia-mention lia-mention-user"&gt;Trostis&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I didn't pay much attention at the first time. I dodn't notice that you are slicing by Category at the columns of your matrix. Which means the values are not just blank, rather they do not exist.&amp;nbsp;&lt;BR /&gt;in your example, the iteration table&amp;nbsp;&lt;SPAN&gt;VALUES ( 'Table'[Día Operativo] ) contains only two rows. In order to iterate over all of the 6 rows we need to calculate the same table but for all the categories becuase category A contains only two rows but all the categories contain all of the 6 rows. Therefore, AVERAGEX will sum the existing two values + 0 for the nonexisting onse then divide over 6&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 15:45:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-daily-average-of-the-displayed-range-when-some/m-p/2922172#M95851</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-11-22T15:45:34Z</dc:date>
    </item>
  </channel>
</rss>

