<?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 Calculate average rate of sale, year to date and vs previous year in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-average-rate-of-sale-year-to-date-and-vs-previous-year/m-p/3547063#M136405</link>
    <description>&lt;P&gt;Hello hello,&lt;/P&gt;&lt;P&gt;Very new to Power BI and trying to do what feels like quite complicated work / at least finding it hard to find solutions by googling.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating a weekly sales dashboard. I have a table visual which shows EPOS sales by product, Week on week %, Year on Year %.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also want to show Rate of Sale, average rate of sale for the year to date, and average rate of sale last year. I have calculated Rate of Sale&amp;nbsp;as follows:&lt;/P&gt;&lt;P&gt;Rate of Sale =&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DIVIDE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Appended Retailer Data'&lt;/SPAN&gt;&lt;SPAN&gt;[Value]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Attributes&lt;/SPAN&gt;&lt;SPAN&gt;[Attribute]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"EPOS Qty"&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Appended Retailer Data'&lt;/SPAN&gt;&lt;SPAN&gt;[Value]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Attributes&lt;/SPAN&gt;&lt;SPAN&gt;[Attribute]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"Est. EPOS Store Count"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;This works and can be added to a table visual by product name (although not the same table visual as my WoW% and YoY% - why is that?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;In theory, rate of sale year to date is just the average of the values for each week for 2023. I am not sure how to do this with my rate of sale measure.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Rate of sale for the same period last year - I think I could use the week rank column of my date table but again unsure how to make this interact with my measure.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;So in summary I have 3 questions:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;- How do I calculate the average of my rate of sale measure?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;- How do I calculate the average of my rate of sale measure for the same period last year?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;- Can these measures be shown in the same table as my EPOS data, WoW% and YoY%? If not, why not?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;Any tips and advice welcome, appreciate this might not be the most complete image of my dataset and workings but it's the best I can do right now &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 22 Nov 2023 15:34:41 GMT</pubDate>
    <dc:creator>slaterboi</dc:creator>
    <dc:date>2023-11-22T15:34:41Z</dc:date>
    <item>
      <title>Calculate average rate of sale, year to date and vs previous year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-average-rate-of-sale-year-to-date-and-vs-previous-year/m-p/3547063#M136405</link>
      <description>&lt;P&gt;Hello hello,&lt;/P&gt;&lt;P&gt;Very new to Power BI and trying to do what feels like quite complicated work / at least finding it hard to find solutions by googling.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating a weekly sales dashboard. I have a table visual which shows EPOS sales by product, Week on week %, Year on Year %.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also want to show Rate of Sale, average rate of sale for the year to date, and average rate of sale last year. I have calculated Rate of Sale&amp;nbsp;as follows:&lt;/P&gt;&lt;P&gt;Rate of Sale =&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DIVIDE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Appended Retailer Data'&lt;/SPAN&gt;&lt;SPAN&gt;[Value]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Attributes&lt;/SPAN&gt;&lt;SPAN&gt;[Attribute]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"EPOS Qty"&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Appended Retailer Data'&lt;/SPAN&gt;&lt;SPAN&gt;[Value]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Attributes&lt;/SPAN&gt;&lt;SPAN&gt;[Attribute]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"Est. EPOS Store Count"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;This works and can be added to a table visual by product name (although not the same table visual as my WoW% and YoY% - why is that?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;In theory, rate of sale year to date is just the average of the values for each week for 2023. I am not sure how to do this with my rate of sale measure.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Rate of sale for the same period last year - I think I could use the week rank column of my date table but again unsure how to make this interact with my measure.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;So in summary I have 3 questions:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;- How do I calculate the average of my rate of sale measure?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;- How do I calculate the average of my rate of sale measure for the same period last year?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;- Can these measures be shown in the same table as my EPOS data, WoW% and YoY%? If not, why not?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;Any tips and advice welcome, appreciate this might not be the most complete image of my dataset and workings but it's the best I can do right now &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 22 Nov 2023 15:34:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-average-rate-of-sale-year-to-date-and-vs-previous-year/m-p/3547063#M136405</guid>
      <dc:creator>slaterboi</dc:creator>
      <dc:date>2023-11-22T15:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate average rate of sale, year to date and vs previous year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-average-rate-of-sale-year-to-date-and-vs-previous-year/m-p/3549855#M136552</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="650397" data-lia-user-login="slaterboi" class="lia-mention lia-mention-user"&gt;slaterboi&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;I'm sorry, but would you mind sharing the sample data? If you can't share more sample data, I would appreciate it if you could describe the structure of the dataset you're using (what tables are included, what columns are contained within each table, what columns are needed for your measures, etc.), that would be helpful.&lt;BR /&gt;And in general, you are perfectly capable of displaying multiple measures in the same table.&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Dino Tao&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2023 01:26:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-average-rate-of-sale-year-to-date-and-vs-previous-year/m-p/3549855#M136552</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-11-24T01:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate average rate of sale, year to date and vs previous year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-average-rate-of-sale-year-to-date-and-vs-previous-year/m-p/3549879#M136555</link>
      <description>&lt;P&gt;&lt;FONT&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="650397" data-lia-user-login="slaterboi" class="lia-mention lia-mention-user"&gt;slaterboi&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Since I don't know what kind of data structure you are using, I can only offer you some suggestions:&lt;BR /&gt;You say you want to calcualte&amp;nbsp;&lt;SPAN&gt;the average of the values for each week for 2023, if I understand you correctly, you want to divide Rate of Sale by the total number of weeks to calculate the average on a weekly basis. Then you need to calculate how many weeks have passed since the beginning of 2023.&lt;BR /&gt;If you are recording weeks in a column like the one shown below, i.e. by weeks of the year:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;You can calculate how many weeks there are by using the &lt;STRONG&gt;DISTINCTCOUNT&lt;/STRONG&gt; function in DAX to calculate how many different values are in the &lt;STRONG&gt;Week&lt;/STRONG&gt; column.&lt;BR /&gt;If your weeks are recorded on a monthly basis, i.e. as shown below:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then you need to do the math for each of the different months and add them together to get the total number of weeks.&lt;BR /&gt;The same goes for last year's measure.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Dino Tao&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;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2023 01:50:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-average-rate-of-sale-year-to-date-and-vs-previous-year/m-p/3549879#M136555</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-11-24T01:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate average rate of sale, year to date and vs previous year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-average-rate-of-sale-year-to-date-and-vs-previous-year/m-p/3551092#M136603</link>
      <description>&lt;P&gt;Hi Dino,&lt;BR /&gt;Thanks for your response. I can't share the data because it's confidential but I will do my best to describe the structure. I have tables containing 2 years worth of sales data for multiple retailers with the following columns; &lt;EM&gt;Item number, item description, week (retailer week number), EPOS sales, EPOS quantity, average instock %, est. EPOS store count, waste value.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;I have then&amp;nbsp;appended these tables to get a table that includes data for all retailers (this is because the format of the data is slightly different for each retailer). I have created various measures in my appended data table:&amp;nbsp;&lt;EM&gt;Total Sales TY, Total Sales LY, Total Sales Year on Year %, Total Sales This Week, Total Sales Last Week, Total Sales Week on Week %, Rate of Sale.&amp;nbsp;&lt;BR /&gt;&lt;/EM&gt;&lt;BR /&gt;I have also have a Calendar table with the following:&amp;nbsp;&lt;EM&gt;Week Commencing date, Retailer Week Number, Year, Calendar Week number, Week Ending date, Week Rank, Week Name, Weekday (numerical), Weekday (text)&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;Cheers&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;Matt&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2023 15:03:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-average-rate-of-sale-year-to-date-and-vs-previous-year/m-p/3551092#M136603</guid>
      <dc:creator>slaterboi</dc:creator>
      <dc:date>2023-11-24T15:03:56Z</dc:date>
    </item>
  </channel>
</rss>

