<?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 Average Distinct Count Over a set time period (ignoring date filter) in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-Distinct-Count-Over-a-set-time-period-ignoring-date/m-p/2298190#M56672</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a report where I want to have a dynamic distinct count of users who have booked time to a project within the last month of a certain date. This is&amp;nbsp;the information that I want to show with the Department Size being the dynamic count and the Capacity worked out from that:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The report has a filter on the reporting date (a Week Commencing date which is in a date table). The relationship is shown here:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;What I want to show is basically the average distinct count of the Employee ID over the previous 4 weeks.&lt;/P&gt;&lt;P&gt;The problem I have is that the slicer causes the result of my measure to be fixed over time whereas I want to see over time the change in this average based on the previous 4 weeks of wherever it lies on the timeline.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see here the Capacity (which uses the Calculated Department Size measure) remains constant over time (as I think it will always pick up the reporting date selected in the slicer). What I want is e.g. 5th December should work out the average over its previous 4 weeks (14th Nov-5th Dec), not the 4 weeks up to the reporting date. This chart isn't connected to the Reporting Date slicer but defaults to last 2 months.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is where I am with the DAX measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Calculated Department Size = 
CALCULATE (
    DISTINCTCOUNT ( Timesheet[Employee ID] ),
    ALL ( 'Reporting Date'[Week Commencing] ),
    Timesheet[Booked Hours] &amp;gt; 0,
    'Reporting Date'[Week Commencing]
        &amp;gt; MAX ( 'Reporting Date'[Week Commencing] ) - 28,
    'Reporting Date'[Week Commencing] &amp;lt; MAX ( 'Reporting Date'[Week Commencing] )
)&lt;/LI-CODE&gt;&lt;P&gt;I don't know whether one measure can do the job or if I need to set up one to cover the reporting date and one to cover the trend over time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Marc&lt;/P&gt;</description>
    <pubDate>Mon, 24 Jan 2022 09:30:22 GMT</pubDate>
    <dc:creator>marcritchie</dc:creator>
    <dc:date>2022-01-24T09:30:22Z</dc:date>
    <item>
      <title>Average Distinct Count Over a set time period (ignoring date filter)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-Distinct-Count-Over-a-set-time-period-ignoring-date/m-p/2298190#M56672</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a report where I want to have a dynamic distinct count of users who have booked time to a project within the last month of a certain date. This is&amp;nbsp;the information that I want to show with the Department Size being the dynamic count and the Capacity worked out from that:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The report has a filter on the reporting date (a Week Commencing date which is in a date table). The relationship is shown here:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;What I want to show is basically the average distinct count of the Employee ID over the previous 4 weeks.&lt;/P&gt;&lt;P&gt;The problem I have is that the slicer causes the result of my measure to be fixed over time whereas I want to see over time the change in this average based on the previous 4 weeks of wherever it lies on the timeline.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see here the Capacity (which uses the Calculated Department Size measure) remains constant over time (as I think it will always pick up the reporting date selected in the slicer). What I want is e.g. 5th December should work out the average over its previous 4 weeks (14th Nov-5th Dec), not the 4 weeks up to the reporting date. This chart isn't connected to the Reporting Date slicer but defaults to last 2 months.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is where I am with the DAX measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Calculated Department Size = 
CALCULATE (
    DISTINCTCOUNT ( Timesheet[Employee ID] ),
    ALL ( 'Reporting Date'[Week Commencing] ),
    Timesheet[Booked Hours] &amp;gt; 0,
    'Reporting Date'[Week Commencing]
        &amp;gt; MAX ( 'Reporting Date'[Week Commencing] ) - 28,
    'Reporting Date'[Week Commencing] &amp;lt; MAX ( 'Reporting Date'[Week Commencing] )
)&lt;/LI-CODE&gt;&lt;P&gt;I don't know whether one measure can do the job or if I need to set up one to cover the reporting date and one to cover the trend over time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Marc&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 09:30:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-Distinct-Count-Over-a-set-time-period-ignoring-date/m-p/2298190#M56672</guid>
      <dc:creator>marcritchie</dc:creator>
      <dc:date>2022-01-24T09:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: Average Distinct Count Over a set time period (ignoring date filter)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-Distinct-Count-Over-a-set-time-period-ignoring-date/m-p/2298435#M56679</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="257358" data-lia-user-login="marcritchie" class="lia-mention lia-mention-user"&gt;marcritchie&lt;/a&gt; , In case you can have week rank in date or week yeat tbale &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;a new column&lt;/P&gt;
&lt;P&gt;Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CALCULATE(AverageX(values('Date'[Year Week]) ,calculate(DISTINCTCOUNT ( Timesheet[Employee ID] ))), FILTER(ALL('Date'),'Date'[Week Rank]&amp;gt;=max('Date'[Week Rank])-8 &amp;amp;&amp;amp; 'Date'[Week Rank]&amp;lt;=max('Date'[Week Rank])))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rolling 4 = CALCULATE(AverageX(values('Date'[Year Week]) ,calculate(DISTINCTCOUNT ( Timesheet[Employee ID] ))),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-28,DAY)) &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 12:00:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-Distinct-Count-Over-a-set-time-period-ignoring-date/m-p/2298435#M56679</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-01-24T12:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Average Distinct Count Over a set time period (ignoring date filter)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-Distinct-Count-Over-a-set-time-period-ignoring-date/m-p/2304830#M57025</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="257358" data-lia-user-login="marcritchie" class="lia-mention lia-mention-user"&gt;marcritchie&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please have a try.&lt;/P&gt;
&lt;P&gt;Change all to allselected.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Calculated Department Size = 
CALCULATE (
    DISTINCTCOUNT ( Timesheet[Employee ID] ),
    ALLSELECTED ( 'Reporting Date'[Week Commencing] ),
    Timesheet[Booked Hours] &amp;gt; 0,
    'Reporting Date'[Week Commencing]
        &amp;gt; MAX ( 'Reporting Date'[Week Commencing] ) - 28,
    'Reporting Date'[Week Commencing] &amp;lt; MAX ( 'Reporting Date'[Week Commencing] )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I have misunderstood your meaning, please provide your pbix file without privacy information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Community Support Team _ Polly&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jan 2022 09:51:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-Distinct-Count-Over-a-set-time-period-ignoring-date/m-p/2304830#M57025</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-27T09:51:13Z</dc:date>
    </item>
  </channel>
</rss>

