<?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: Average Distribution by weekday in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-Distribution-by-weekday/m-p/4063846#M161327</link>
    <description>&lt;P&gt;Could you please provide some sample data ?&lt;/P&gt;</description>
    <pubDate>Fri, 26 Jul 2024 13:24:33 GMT</pubDate>
    <dc:creator>SachinNandanwar</dc:creator>
    <dc:date>2024-07-26T13:24:33Z</dc:date>
    <item>
      <title>Average Distribution by weekday</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-Distribution-by-weekday/m-p/4063678#M161316</link>
      <description>&lt;P&gt;Hi, I'm trying to create a measure with an average distribution % per weekday. I previously solved it with calculated columns but that's slow. So a measure should solve some of that. I have a table with actual data on a daily level, I also have a calendar table with a True/False column if the dates should be included in the average.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The period total average is calculated with these measures:&amp;nbsp;&lt;/P&gt;&lt;P&gt;ACT DISTRIBUTION OFFERED:=SUM(fDistribution[OFFERED])&lt;/P&gt;&lt;P&gt;FC DISTRIBUTION OFFERED:=CALCULATE([ACT DISTRIBUTION OFFERED];FILTER(dDate;dDate[DistrWeeks]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next I need a numerator to divide the total average to get to a daily average percentage. The numerator should be based on a weekday (e.g. Mondays depending on filter context). How would I go about calculating the average of a weekday?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2024 11:57:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-Distribution-by-weekday/m-p/4063678#M161316</guid>
      <dc:creator>Leewism</dc:creator>
      <dc:date>2024-07-26T11:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: Average Distribution by weekday</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-Distribution-by-weekday/m-p/4063846#M161327</link>
      <description>&lt;P&gt;Could you please provide some sample data ?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2024 13:24:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-Distribution-by-weekday/m-p/4063846#M161327</guid>
      <dc:creator>SachinNandanwar</dc:creator>
      <dc:date>2024-07-26T13:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: Average Distribution by weekday</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-Distribution-by-weekday/m-p/4066065#M161416</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="781315" data-lia-user-login="Leewism" class="lia-mention lia-mention-user"&gt;Leewism&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the reply from&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="777262" data-lia-user-login="SachinNandanwar" class="lia-mention lia-mention-user"&gt;SachinNandanwar&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the NETWORKDAYS function to calculate the working days between dates.&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/dax/networkdays-function-dax" target="_blank"&gt;NETWORKDAYS function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created a simple sample data, hope it can help you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sample data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Slicer table&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DataTable&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;no relationship between two tables&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a measure as follows&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR _min = MIN('Date'[Date])
VAR _max = MAX('Date'[Date])
VAR _workday = NETWORKDAYS(_min, _max)
VAR _SUM = CALCULATE(SUM('DataTable'[value]), FILTER('DataTable', [Date] &amp;gt;= _min &amp;amp;&amp;amp; [Date] &amp;lt;= _max))
RETURN
DIVIDE(_SUM, _workday)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If the above result is not what you want, then as &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="777262" data-lia-user-login="SachinNandanwar" class="lia-mention lia-mention-user"&gt;SachinNandanwar&lt;/a&gt;&amp;nbsp;said, you need to provide some sample data and the expected results based on the sample data so that we can help you better.&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank" rel="noopener"&gt;How to provide sample data in the Power BI Forum - Microsoft Fabric Community&lt;/A&gt;&amp;nbsp;Or show them as screenshots or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yulia Xu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2024 03:10:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-Distribution-by-weekday/m-p/4066065#M161416</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-29T03:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: Average Distribution by weekday</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-Distribution-by-weekday/m-p/4068334#M161507</link>
      <description>&lt;P&gt;Thanks for the ideas so far. I'm not looking for working days though. I'm looking to sum the weekdays. I want to know the average of all Mondays, Tuesdays etc for every day of the week.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't share my file, hopefully these screenshots will help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my source table to calculate the daily distribution on.&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;A diagram overview of my stables&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;The table to apply the calculated distribution on.&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;So far these are my results in a pivot table.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sum of Offered is an implicit measure for now just the check my results. ACT or FC VOL DAY only show data for mondays, I want it show the weekly volume multiplied by the distribution percentage to get to a daily volume.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;!--  StartFragment   --&gt;&lt;SPAN class=""&gt;ACT DISTRIBUTION OFFERED:=&lt;/SPAN&gt;&lt;SPAN class=""&gt;SUM&lt;/SPAN&gt;&lt;SPAN class=""&gt;(fDistribution[OFFERED])&lt;/SPAN&gt;&lt;!--  EndFragment   --&gt;&lt;/P&gt;&lt;P&gt;&lt;!--  StartFragment   --&gt;&lt;SPAN class=""&gt;ACT DISTRIBUTION OFFERED WEEK:=&lt;/SPAN&gt;&lt;SPAN class=""&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN class=""&gt;([ACT DISTRIBUTION OFFERED];&lt;/SPAN&gt;&lt;SPAN class=""&gt;ALL&lt;/SPAN&gt;&lt;SPAN class=""&gt;(dDate[Date]);&lt;/SPAN&gt;&lt;SPAN class=""&gt;VALUES&lt;/SPAN&gt;&lt;SPAN class=""&gt;(dDate[Year_Wk]))&lt;/SPAN&gt;&lt;!--  EndFragment   --&gt;&lt;/P&gt;&lt;P&gt;&lt;!--  StartFragment   --&gt;&lt;SPAN class=""&gt;ACT DISTRIBUTION:=&lt;/SPAN&gt;&lt;SPAN class=""&gt;DIVIDE&lt;/SPAN&gt;&lt;SPAN class=""&gt;([ACT DISTRIBUTION OFFERED DAY];[ACT DISTRIBUTION OFFERED WEEK])&lt;/SPAN&gt;&lt;!--  EndFragment   --&gt;&lt;/P&gt;&lt;P&gt;&lt;!--  StartFragment   --&gt;&lt;SPAN class=""&gt;ACT DISTRIBUTION OFFERED DAY:=&lt;/SPAN&gt;&lt;SPAN class=""&gt;SUMX&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;VALUES&lt;/SPAN&gt;&lt;SPAN class=""&gt;(dDate[Date]);[ACT DISTRIBUTION OFFERED])&lt;/SPAN&gt;&lt;!--  EndFragment   --&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;!--  StartFragment   --&gt;&lt;SPAN class=""&gt;FC DISTRIBUTION OFFERED:=&lt;/SPAN&gt;&lt;SPAN class=""&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN class=""&gt;([ACT DISTRIBUTION OFFERED];&lt;/SPAN&gt;&lt;SPAN class=""&gt;FILTER&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;ALLSELECTED&lt;/SPAN&gt;&lt;SPAN class=""&gt;(dDate);dDate[DistrWeeks]))&lt;/SPAN&gt;&lt;!--  EndFragment   --&gt;&lt;/P&gt;&lt;P&gt;&lt;!--  StartFragment   --&gt;&lt;SPAN class=""&gt;FC DISTRIBUTION OFFERED DAY:=&lt;/SPAN&gt;&lt;SPAN class=""&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN class=""&gt;([ACT DISTRIBUTION OFFERED];&lt;/SPAN&gt;&lt;SPAN class=""&gt;FILTER&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;ALLSELECTED&lt;/SPAN&gt;&lt;SPAN class=""&gt;(dDate);dDate[Day of Week]=&lt;/SPAN&gt;&lt;SPAN class=""&gt;max&lt;/SPAN&gt;&lt;SPAN class=""&gt;(dDate[Day of Week])&amp;amp;&amp;amp;dDate[DistrWeeks]))&lt;/SPAN&gt;&lt;!--  EndFragment   --&gt;&lt;/P&gt;&lt;P&gt;&lt;!--  StartFragment   --&gt;&lt;SPAN class=""&gt;FC DISTRIBUTION:=&lt;/SPAN&gt;&lt;SPAN class=""&gt;DIVIDE&lt;/SPAN&gt;&lt;SPAN class=""&gt;([FC DISTRIBUTION OFFERED DAY];[FC DISTRIBUTION OFFERED])&lt;/SPAN&gt;&lt;!--  EndFragment   --&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;dDate[DistrWeeks] is a column where I limit the weeks in the average. Like the last 10 weeks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;!--  StartFragment   --&gt;ACT VOL WEEK:=&lt;SPAN class=""&gt;CALCULATE&lt;/SPAN&gt;(&lt;SPAN class=""&gt;SUM&lt;/SPAN&gt;(fExportWeek[Actual]);&lt;SPAN class=""&gt;FILTER&lt;/SPAN&gt;(fExportWeek;fExportWeek[PI]=&lt;SPAN class=""&gt;"Offered"&lt;/SPAN&gt;))&lt;!--  EndFragment   --&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;!--  StartFragment   --&gt;ACT VOL DAY:=&lt;SPAN class=""&gt;SUM&lt;/SPAN&gt;(fExportWeek[Actual])*[ACT DISTRIBUTION]&lt;!--  EndFragment   --&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;!--  StartFragment   --&gt;FC VOL WEEK:=&lt;SPAN class=""&gt;CALCULATE&lt;/SPAN&gt;(&lt;SPAN class=""&gt;SUM&lt;/SPAN&gt;(fExportWeek[Forecast]);&lt;SPAN class=""&gt;FILTER&lt;/SPAN&gt;(fExportWeek;fExportWeek[PI]=&lt;SPAN class=""&gt;"Offered"&lt;/SPAN&gt;))&lt;!--  EndFragment   --&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;!--  StartFragment   --&gt;FC VOL DAY:=&lt;SPAN class=""&gt;SUM&lt;/SPAN&gt;(fExportWeek[Forecast])*[FC DISTRIBUTION]&lt;!--  EndFragment   --&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Hope it makes sense now. I'm not sure if I am taking the right approach.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2024 06:06:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-Distribution-by-weekday/m-p/4068334#M161507</guid>
      <dc:creator>Leewism</dc:creator>
      <dc:date>2024-07-30T06:06:13Z</dc:date>
    </item>
  </channel>
</rss>

