<?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: Last 6 month weighted average in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1291190#M22190</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;, it&amp;nbsp; shows an error&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;It may seem a little silly, please don't mind as I am still at a beginner level and maybe I am missing some logic behind the syntax&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Aug 2020 17:00:22 GMT</pubDate>
    <dc:creator>Avivek</dc:creator>
    <dc:date>2020-08-12T17:00:22Z</dc:date>
    <item>
      <title>Last 6 month weighted average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1290581#M22160</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I tried to create a measure of last 6 month weighted average days, the measure is as follows;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;STRONG&gt;Wt avg 2&lt;/STRONG&gt;&amp;nbsp;= CALCULATE(SUMX(RECEIVABLES,RECEIVABLES[Days Diff]*RECEIVABLES[Weights]))&lt;BR /&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;Last 6 months Wt Avg&lt;/STRONG&gt;&amp;nbsp;=&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR enddate = EOMONTH('LAST REFRESHED'[Data Last Refreshed],-1)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR startdate = EOMONTH(enddate,-6)+1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR DateTable =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATETABLE(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'DATE',&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FILTER('DATE','DATE'[Calendar Date]&amp;gt;= startdate &amp;amp;&amp;amp; 'DATE'[Calendar Date]&amp;lt;enddate)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;---------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR wtavg =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE( [Wt avg 2],DateTable)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;wtavg&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;But when I manually checked for individual accounts for the last 6 months and it does not match all.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a problem with the measure and what needs to be corrected if so.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 13:29:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1290581#M22160</guid>
      <dc:creator>Avivek</dc:creator>
      <dc:date>2020-08-12T13:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: Last 6 month weighted average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1290617#M22163</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="237547" data-lia-user-login="Avivek" class="lia-mention lia-mention-user"&gt;Avivek&lt;/a&gt; , try like&lt;/P&gt;
&lt;P&gt;Last 6 months Wt Avg =&lt;BR /&gt;VAR enddate = EOMONTH('LAST REFRESHED'[Data Last Refreshed],-1)&lt;BR /&gt;VAR startdate = EOMONTH(enddate,-6)+1&lt;/P&gt;
&lt;P&gt;VAR wtavg =&lt;BR /&gt;CALCULATE( [Wt avg 2],&lt;BR /&gt;FILTER('DATE','DATE'[Calendar Date]&amp;gt;= startdate &amp;amp;&amp;amp; 'DATE'[Calendar Date]&amp;lt;= enddate)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 13:43:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1290617#M22163</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-08-12T13:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: Last 6 month weighted average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1291190#M22190</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;, it&amp;nbsp; shows an error&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;It may seem a little silly, please don't mind as I am still at a beginner level and maybe I am missing some logic behind the syntax&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 17:00:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1291190#M22190</guid>
      <dc:creator>Avivek</dc:creator>
      <dc:date>2020-08-12T17:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Last 6 month weighted average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1291243#M22192</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="237547" data-lia-user-login="Avivek" class="lia-mention lia-mention-user"&gt;Avivek&lt;/a&gt;&amp;nbsp;, try like&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Last 6 months Wt Avg =&lt;BR /&gt;VAR enddate = EOMONTH('LAST REFRESHED'[Data Last Refreshed],-1)&lt;BR /&gt;VAR startdate = EOMONTH(enddate,-6)+1&lt;/P&gt;
&lt;P&gt;return&lt;BR /&gt;CALCULATE( [Wt avg 2],&lt;BR /&gt;FILTER('DATE','DATE'[Calendar Date]&amp;gt;= startdate &amp;amp;&amp;amp; 'DATE'[Calendar Date]&amp;lt;= enddate)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 17:35:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1291243#M22192</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-08-12T17:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: Last 6 month weighted average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1291564#M22219</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;It gives same answer, the new measure I named it as Last 6 month Wt Avg3,&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;also in this pic if we see in month and year it should be only for 6 months buts its showing for all the months and year, ideally by the measure it should be for 07/2020, 06/2020, 05/2020, 04/2020, 03/2020, 02/2020.&lt;/P&gt;&lt;P&gt;So I am not able to figure it out what is it i am missing, can you please help me out here.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 20:00:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1291564#M22219</guid>
      <dc:creator>Avivek</dc:creator>
      <dc:date>2020-08-12T20:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: Last 6 month weighted average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1293660#M22288</link>
      <description>1. Are you sure that [Wt avg 2] is correct? Have you confirmed this on many different periods of time?&lt;BR /&gt;2. Is the 'Date' table marked as the Date table in the model and correctly connected to the 'Receivables' fact table?&lt;BR /&gt;3. How did you check manually? When doing this manually, are you using exactly the same formulas as in the measure [Wt avg 2]?</description>
      <pubDate>Thu, 13 Aug 2020 13:47:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1293660#M22288</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-13T13:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: Last 6 month weighted average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1293675#M22290</link>
      <description>&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="237547" data-lia-user-login="Avivek" class="lia-mention lia-mention-user"&gt;Avivek&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;I understand that the field [Month &amp;amp; Year] is one taken from the DATE table? I think the problem you've got stems from the fact that you have hardcoded into your measure the dates through 'LAST REFRESHED'[Data Last Refreshed]. Since this is the same on all the rows in your visual, you don't get a 6-Month Weighted Average for the chunk of time that you've put on your rows but for the 6-Mth period that end on the last refresh date.</description>
      <pubDate>Thu, 13 Aug 2020 13:53:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1293675#M22290</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-13T13:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Last 6 month weighted average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1293745#M22292</link>
      <description>&lt;P&gt;Try this one:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// Last 6-Month Weighted Average

[Last 6M Wt Avg] =
var __lastDate = MAX( 'Date'[Calendar Date] )
var __veryFirstDateInCalendar =
    FIRSTDATE(
        ALL( 'Date'[Calendar Date] )
    )
// we have to check if there are enough days
// in the Date table to cover the 6Mth period
// starting from __lastDate (and going back).
// If not, we have to return BLANK().
var __boundaryDate = 
    DATEADD(
        __veryFirstDateInCalendar,
        +6,
        MONTH
    ) - 1
var __result =
    if( __boundaryDate &amp;lt;= __lastDate,
        var __period = 
            DATESINPERIOD(
                'Date'[Calendar Date],
                __lastDate,
                -6,
                MONTH
            )
        var __avg =
            CALCULATE(
                [Wt avg 2],
                __period
            )
        return
            __avg
    )
return
    __result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course, the Date table must be marked as such in the model and the unique date indentifier must be the 'Date'[Calendar Date] column. Since this table should contain at least 1 full year of dates, the code above works correctly.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 14:12:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1293745#M22292</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-13T14:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Last 6 month weighted average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1293914#M22299</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made soome changes in the measure and changed it to payment received date instead of calendar date and although it gives the right individual value but the total is not correct&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;Wt avg 2 = CALCULATE(SUMX(RECEIVABLES,RECEIVABLES[Days Diff]*RECEIVABLES[Weights]))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&amp;nbsp;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;Last 6 months Wt Avg4 =&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;VAR enddate = EOMONTH('LAST REFRESHED'[Data Last Refreshed],-1)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;VAR startdate = EOMONTH(enddate,-6)+1&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;CALCULATE( [Wt avg 2],&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;FILTER('RECEIVABLES','RECEIVABLES'[Payment Recieved date]&amp;gt;= startdate &amp;amp;&amp;amp; RECEIVABLES[Payment Recieved date]&amp;lt;= enddate))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&amp;nbsp;&lt;DIV&gt;&amp;nbsp;&lt;DIV&gt;&amp;nbsp;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;Below is the sanp of the report and there we can see that the totals do not match with the value&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Though the measure works it still gives inaccurate total.&lt;/P&gt;&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;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 13 Aug 2020 17:10:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1293914#M22299</guid>
      <dc:creator>Avivek</dc:creator>
      <dc:date>2020-08-13T17:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: Last 6 month weighted average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1294387#M22326</link>
      <description>&lt;P&gt;Thankyou&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;, I madea small change, instead of using the calender date I used the payment recieved date and individually records are correct but when it shows as total its not the correct value. Below is the measure:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;STRONG&gt;Wt avg 2&lt;/STRONG&gt; = CALCULATE(SUMX(RECEIVABLES,RECEIVABLES[Days Diff]*RECEIVABLES[Weights]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;STRONG&gt;Last 6 months Wt Avg4&lt;/STRONG&gt; = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR enddate = EOMONTH('LAST REFRESHED'[Data Last Refreshed],-1)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR startdate = EOMONTH(enddate,-6)+1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE( [Wt avg 2],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FILTER('RECEIVABLES','RECEIVABLES'[Payment Recieved date]&amp;gt;= startdate &amp;amp;&amp;amp; RECEIVABLES[Payment Recieved date]&amp;lt;= enddate))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;Below is the sanp of the report and there we can see that the totals do not match with the value&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Though the measure works it still gives inaccurate total.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 13 Aug 2020 18:45:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-6-month-weighted-average/m-p/1294387#M22326</guid>
      <dc:creator>Avivek</dc:creator>
      <dc:date>2020-08-13T18:45:14Z</dc:date>
    </item>
  </channel>
</rss>

