<?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: How to calculate a value with dynamic count in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2743446#M84410</link>
    <description>&lt;P&gt;Thanks for the explanation. In this case I think the answer might be simpler:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Average2 = 
VAR __Calc = SUMX( VALUES( 'Table'[Item] ), CALCULATE( AVERAGE( 'Table'[Sales] )))
RETURN
    __Calc&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 02 Sep 2022 12:00:58 GMT</pubDate>
    <dc:creator>Adescrit</dc:creator>
    <dc:date>2022-09-02T12:00:58Z</dc:date>
    <item>
      <title>How to calculate a value with dynamic count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2739610#M84138</link>
      <description>&lt;P&gt;Hi I would like to as the following advice:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Item&lt;/TD&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2019&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2020&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2020&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;So when i select the timeline 2020, the calculation will give me an average (5+15)/2, when select 2021, the calculation will be (5+10+15)/3 for item A&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While the same for item B, when I select 2020, the average will be 20 and for 2021, the calculation will be (20+30)/2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Overall the equation will sum up the total base on time range selected and divide the total base on how many count found within that period and provide me an average for the item.&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;</description>
      <pubDate>Thu, 01 Sep 2022 04:34:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2739610#M84138</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-01T04:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a value with dynamic count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2740082#M84170</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&amp;nbsp;Anonymous&lt;/LI-USER&gt;&lt;/P&gt;
&lt;P&gt;Does this work for you:&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 = 
VAR __Year =
    SELECTEDVALUE ( 'Table'[Year] )
VAR __YearCheck = IF( ISBLANK( __Year ), MAX( 'Table'[Year] ), __Year )
RETURN
    CALCULATE (
        AVERAGE ( 'Table'[Sales] ),
        ALLSELECTED ( 'Table'[Item] ),
        'Table'[Year] &amp;lt;= __YearCheck
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;&lt;BR /&gt;
&lt;P&gt;P.S. if you don't filter on a year it will take an average over all years.&lt;/P&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 08:11:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2740082#M84170</guid>
      <dc:creator>Adescrit</dc:creator>
      <dc:date>2022-09-01T08:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a value with dynamic count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2740526#M84212</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry I forgot to mention the year also contains date and the expression is like "01 Jun 2019", is it possible to adjust the formula to suit that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 10:32:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2740526#M84212</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-01T10:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a value with dynamic count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2740676#M84218</link>
      <description>&lt;P&gt;If you replace the Year column with a reference to the Date column in the same formula, does that work?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 11:57:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2740676#M84218</guid>
      <dc:creator>Adescrit</dc:creator>
      <dc:date>2022-09-01T11:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a value with dynamic count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2740858#M84227</link>
      <description>&lt;P&gt;The formula is working but unfortunately the result is not as the same as expected.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The formula averaged both A &amp;amp; B item together and come up with 1 total average instead of 2 separated average for item A &amp;amp; B.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above result is item A (5+10) and B (20) , the average under this formula become (5+10+20)/3 = 11.67 instead of 10 for item A and 20 for item B.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Furthermore if it is possible can the outcome be summing up the average from both A and B? (in this case my hope is to have the sum of the average (10+20) = 30&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 13:10:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2740858#M84227</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-01T13:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a value with dynamic count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2742857#M84356</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How about this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Average2 = 
VAR __Date = SELECTEDVALUE( 'Table'[Date])
VAR __Calc = SUMX( VALUES( 'Table'[Item] ), CALCULATE( AVERAGE( 'Table'[Sales] ),  'Table'[Date] &amp;lt;= __Date ) )
RETURN
    __Calc&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 02 Sep 2022 08:28:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2742857#M84356</guid>
      <dc:creator>Adescrit</dc:creator>
      <dc:date>2022-09-02T08:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a value with dynamic count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2743276#M84386</link>
      <description>&lt;P&gt;Hi Adescrit,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for coming back, the formula is not returning any value if I pull and select more than 1 date in the timeline slicer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But if i select a specific date, it does calculate the average of for all the value before the selected date, any chance we can adjust the date filter?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 10:28:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2743276#M84386</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-02T10:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a value with dynamic count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2743283#M84387</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please confirm for me how you expect it to work? Should it provide the average for the exact date(s) you have selected?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your examples I assumed it was an average of all dates up to and including the one selected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Adrian&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 10:31:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2743283#M84387</guid>
      <dc:creator>Adescrit</dc:creator>
      <dc:date>2022-09-02T10:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a value with dynamic count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2743313#M84391</link>
      <description>&lt;P&gt;Hi Adrian,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for the confusion, let me rephase my question below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Example:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Year&lt;/TD&gt;&lt;TD&gt;Item&lt;/TD&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/01/2019&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/05/2019&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/06/2020&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/06/2020&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to have a caluclation that can provide me a dynamic caluclation on the sum of average.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;For example, if I pull the timeline slicer to May 2019 it gives me a sum of average A(5) + average B(25) = 25&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;And when I adjust the timeline from May 2019 to cover Jun 2020, the result should be total of average A(15) + average B((20+30)/2) with these period which is 40. In this case Jan 2019 data will be excluded.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate your help!&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 10:50:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2743313#M84391</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-02T10:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a value with dynamic count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2743446#M84410</link>
      <description>&lt;P&gt;Thanks for the explanation. In this case I think the answer might be simpler:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Average2 = 
VAR __Calc = SUMX( VALUES( 'Table'[Item] ), CALCULATE( AVERAGE( 'Table'[Sales] )))
RETURN
    __Calc&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 02 Sep 2022 12:00:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2743446#M84410</guid>
      <dc:creator>Adescrit</dc:creator>
      <dc:date>2022-09-02T12:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a value with dynamic count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2743699#M84437</link>
      <description>&lt;P&gt;Hi Adrian,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are amazing, didn't know this formula can be done in this way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 13:34:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-value-with-dynamic-count/m-p/2743699#M84437</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-02T13:34:17Z</dc:date>
    </item>
  </channel>
</rss>

