<?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 Need DAX Help in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-DAX-Help/m-p/2984109#M100094</link>
    <description>&lt;P&gt;I used below measure to create average of 3 years of sales&lt;BR /&gt;AVG Sales =&lt;BR /&gt;var sales_2019=CALCULATE([salesvalue],'Date'[Month]=201812)&lt;BR /&gt;var sales_2020=CALCULATE([salesvalue],'Date'[Month]=201912)&lt;BR /&gt;var sales_2021=CALCULATE([salesvalue],'Date'[Month]=202012)&lt;BR /&gt;var avg_sales= (sales_2019+sales_2020+sales_2021)/3&lt;BR /&gt;return avg_sales&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the line chart I have to show comparison of dec 2021 sales vs avg sales in last 3 yrs&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;X axis - Dec month dates&lt;BR /&gt;Y axis - Sales and Avg sales&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Avg sales trend is not showing in line chart but in card it shows. AVG values are blank.&lt;/P&gt;&lt;P&gt;I want to show dec sales vs avg sales(3yrs) for each dates in line chart. Could you please help me to get the DAX&lt;/P&gt;</description>
    <pubDate>Thu, 22 Dec 2022 11:54:45 GMT</pubDate>
    <dc:creator>meena16_vibrant</dc:creator>
    <dc:date>2022-12-22T11:54:45Z</dc:date>
    <item>
      <title>Need DAX Help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-DAX-Help/m-p/2984109#M100094</link>
      <description>&lt;P&gt;I used below measure to create average of 3 years of sales&lt;BR /&gt;AVG Sales =&lt;BR /&gt;var sales_2019=CALCULATE([salesvalue],'Date'[Month]=201812)&lt;BR /&gt;var sales_2020=CALCULATE([salesvalue],'Date'[Month]=201912)&lt;BR /&gt;var sales_2021=CALCULATE([salesvalue],'Date'[Month]=202012)&lt;BR /&gt;var avg_sales= (sales_2019+sales_2020+sales_2021)/3&lt;BR /&gt;return avg_sales&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the line chart I have to show comparison of dec 2021 sales vs avg sales in last 3 yrs&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;X axis - Dec month dates&lt;BR /&gt;Y axis - Sales and Avg sales&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Avg sales trend is not showing in line chart but in card it shows. AVG values are blank.&lt;/P&gt;&lt;P&gt;I want to show dec sales vs avg sales(3yrs) for each dates in line chart. Could you please help me to get the DAX&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 11:54:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-DAX-Help/m-p/2984109#M100094</guid>
      <dc:creator>meena16_vibrant</dc:creator>
      <dc:date>2022-12-22T11:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: Need DAX Help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-DAX-Help/m-p/2984177#M100098</link>
      <description>&lt;P&gt;hi&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="453695" data-lia-user-login="meena16_vibrant" class="lia-mention lia-mention-user"&gt;meena16_vibrant&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try like:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;DIV&gt;AVG Sales =&lt;DIV&gt;var sales_2019=CALCULATE([salesvalue], DATEADD('Date'[Date], -3, YEAR))&lt;DIV&gt;var sales_2020=CALCULATE([salesvalue], DATEADD('Date'[Date], -2, YEAR))&lt;DIV&gt;var sales_2021=CALCULATE([salesvalue], DATEADD('Date'[Date], -1, YEAR))&lt;DIV&gt;var avg_sales= (sales_2019+sales_2020+sales_2021)/3&lt;DIV&gt;return avg_sales&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 12:27:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-DAX-Help/m-p/2984177#M100098</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2022-12-22T12:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need DAX Help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-DAX-Help/m-p/2984294#M100102</link>
      <description>&lt;P&gt;&amp;nbsp;It worked.Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 13:11:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-DAX-Help/m-p/2984294#M100102</guid>
      <dc:creator>meena16_vibrant</dc:creator>
      <dc:date>2022-12-22T13:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: Need DAX Help</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-DAX-Help/m-p/2984302#M100103</link>
      <description>&lt;P&gt;Here's a measure you can try instead. Note you can use the IN syntax to avoid replicate measures like you have for each year to improve performance.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Avg Past 3 Yrs =
VAR thisdate =
    MAX ( 'Date'[Date] )
VAR thismonth =
    MONTH ( thisdate )
VAR thisyear =
    YEAR ( thisdate )
RETURN
    CALCULATE (
        AVERAGEX ( DISTINCT ( 'Date'[Month] ), [Total Sales] ),
        //use your measure instead of [Total Sales]
        ALL ( 'Date' ),
        'Date'[Monthnumber] = thismonth,
        //use the Monthnumber and Year columns (whole numbers) in your Date table; create if needed
        'Date'[Year] &amp;gt;= thisyear - 3
            &amp;amp;&amp;amp; 'Date'[Year] &amp;lt; thisyear
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pat&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 13:14:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-DAX-Help/m-p/2984302#M100103</guid>
      <dc:creator>ppm1</dc:creator>
      <dc:date>2022-12-22T13:14:48Z</dc:date>
    </item>
  </channel>
</rss>

