<?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 Tableau expression into DAX in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tableau-expression-into-DAX/m-p/3103532#M109221</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a Tableau expression that I would like to convert into DAX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PREVIOUS_VALUE(0)+&lt;/P&gt;&lt;P&gt;MIN(&lt;BR /&gt;WINDOW_AVG(SUM([values]),-365-[Days Average],-365+[Days Average]),&lt;BR /&gt;WINDOW_AVG(SUM([values]),-730-[Days Average],-730+[Days Average])&lt;BR /&gt;)&lt;/P&gt;</description>
    <pubDate>Tue, 28 Feb 2023 12:15:22 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-02-28T12:15:22Z</dc:date>
    <item>
      <title>Tableau expression into DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tableau-expression-into-DAX/m-p/3103532#M109221</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a Tableau expression that I would like to convert into DAX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PREVIOUS_VALUE(0)+&lt;/P&gt;&lt;P&gt;MIN(&lt;BR /&gt;WINDOW_AVG(SUM([values]),-365-[Days Average],-365+[Days Average]),&lt;BR /&gt;WINDOW_AVG(SUM([values]),-730-[Days Average],-730+[Days Average])&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 12:15:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tableau-expression-into-DAX/m-p/3103532#M109221</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-28T12:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: Tableau expression into DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tableau-expression-into-DAX/m-p/3103737#M109233</link>
      <description>&lt;P&gt;Cumulative Rolling Average =&lt;/P&gt;&lt;P&gt;VAR PrevValue =&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUM([values]),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FILTER(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ALLSELECTED(),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MAX('Table'[Date]) = EARLIER(MAX('Table'[Date]))&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; PrevValue +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; MINX(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WINDOWAVG(SUM([values]), -365 - [Days Average], -365 + [Days Average])&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WINDOWAVG(SUM([values]), -730 - [Days Average], -730 + [Days Average])&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [Cumulative Rolling Average]&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 28 Feb 2023 13:29:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tableau-expression-into-DAX/m-p/3103737#M109233</guid>
      <dc:creator>MAwwad</dc:creator>
      <dc:date>2023-02-28T13:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Tableau expression into DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tableau-expression-into-DAX/m-p/3103833#M109245</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="447406" data-lia-user-login="MAwwad" class="lia-mention lia-mention-user"&gt;MAwwad&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) In the first part of the query I get the following error message:&lt;BR /&gt;"The first argument of EARLIER/EARLIEST is not a valid column reference in the earlier row context.", - related to this row,&amp;nbsp;&lt;SPAN&gt;MAX('Table'[Date]) = EARLIER(MAX('Table'[Date])) .&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;2) Also, I am not sure whwther&amp;nbsp;&lt;SPAN&gt;WINDOWAVG function is avaialble, unless it is possible to combine WINDOW and AVERAGE somehow?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 14:18:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tableau-expression-into-DAX/m-p/3103833#M109245</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-28T14:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Tableau expression into DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tableau-expression-into-DAX/m-p/3104278#M109294</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding your first question, the error message suggests that the column reference 'Table'[Date] is not valid in the context of the EARLIER function. This can happen if the EARLIER function is being used in a calculated column, and the column reference is not part of the column being calculated.&lt;/P&gt;&lt;P&gt;To resolve this issue, you can try using a measure instead of a calculated column, which allows you to refer to columns outside of the current row context. You can define a measure using the CALCULATE function, and then use the MAXX function to calculate the maximum date within the current filter context. Here's an example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;DIV class=""&gt;Max Date = CALCULATE ( MAXX ( '&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Table', '&lt;SPAN class=""&gt;Table'&lt;SPAN class=""&gt;[Date] ), &lt;SPAN class=""&gt;FILTER ( '&lt;SPAN class=""&gt;Table', '&lt;SPAN class=""&gt;Table'&lt;SPAN class=""&gt;[Category] = EARLIER ( '&lt;SPAN class=""&gt;Table'&lt;SPAN class=""&gt;[Category] ) ) )&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV class=""&gt;&lt;P&gt;This measure calculates the maximum date for each category in the 'Table' table, by filtering the table to only include rows with the same category as the current row context.&lt;/P&gt;&lt;P&gt;Regarding your second question, the WINDOWAVG function is not a built-in function in DAX. However, you can use the AVERAGEX function along with a FILTER function to calculate a moving average over a specified window of rows. Here's an example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;DIV class=""&gt;Moving Avg = AVERAGEX ( &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;FILTER ( '&lt;SPAN class=""&gt;Table', '&lt;SPAN class=""&gt;Table'&lt;SPAN class=""&gt;[Date] &amp;gt;= EARLIER ( '&lt;SPAN class=""&gt;Table'&lt;SPAN class=""&gt;[Date] ) - &lt;SPAN class=""&gt;6 &amp;amp;&amp;amp; '&lt;SPAN class=""&gt;Table'&lt;SPAN class=""&gt;[Date] &amp;lt;= EARLIER ( '&lt;SPAN class=""&gt;Table'&lt;SPAN class=""&gt;[Date] ) ), '&lt;SPAN class=""&gt;Table'&lt;SPAN class=""&gt;[Value] )&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;This measure calculates a 7-day moving average for the 'Value' column in the 'Table' table, by filtering the table to include only rows with a date within the last 7 days, relative to the current row context.&lt;/P&gt;&lt;P&gt;I hope this helps! Let me know if you have any further questions.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 28 Feb 2023 16:35:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tableau-expression-into-DAX/m-p/3104278#M109294</guid>
      <dc:creator>MAwwad</dc:creator>
      <dc:date>2023-02-28T16:35:57Z</dc:date>
    </item>
  </channel>
</rss>

