<?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: Calculating rolling average based on a expression and connection with a second data table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-rolling-average-based-on-a-expression-and-connection/m-p/3340728#M125382</link>
    <description>&lt;P&gt;Unfortunately that doesn't work :(. I use the technique with 2 Date tables based on this video&amp;nbsp;&lt;A href="https://www.youtube.com/watch?v=d8Rm7dwM6gc" target="_blank"&gt;https://www.youtube.com/watch?v=d8Rm7dwM6gc&lt;/A&gt;. Maybe after you have seen this, you can help me?&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jul 2023 11:50:17 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-07-20T11:50:17Z</dc:date>
    <item>
      <title>Calculating rolling average based on a expression and connection with a second data table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-rolling-average-based-on-a-expression-and-connection/m-p/3338532#M125252</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data is as follows:&lt;/P&gt;&lt;P&gt;I have 2 Date Tables, one is called 'D Kalender'&amp;nbsp; and the other is called 'D Kalender Previous'. The&amp;nbsp;'D Kalender Previous' is table which is a copy of 'D Kalender' table. Both tables are connected via *-1 relationship from 'D Kalender' to 'D Kalender Previous', based on [TID_ID] that's inactive.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've done this because I have build 1 report, with many visuals and some visuals I want to show only based on the selected period (monthyear) and others I want to show from the selected period-13 months to the selected period. For the first kind of visuals I have 'D Kalender[MonthYear]' are tables or cards without x-axis and shows only data based on the selected month or for example YTD calculated by a formula based on the selected date. For the second kind of visuals that are mostly line charts, where I have 'D Kalender Previous[MonthYear] on the x-axis. So that I see for example not only 1 month, but the values of the last 13 months. Based on this video&amp;nbsp;&lt;A href="https://www.youtube.com/watch?v=d8Rm7dwM6gc" target="_blank"&gt;https://www.youtube.com/watch?v=d8Rm7dwM6gc&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I have a measure to calculate the actuals, called [Actuals], that's a formula that takes the sum of a lot of values. Without filtering on dates. This measure I used for the first kind of visuals. For the second kind of visuals I have use a newly created measure called [&lt;SPAN&gt;Actuals siste 13 månader avhenging av valgt dato] to show the actuals each month. And this works fine!&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The measure is as follows:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Actuals siste 13 månader avhenging av valgt dato = &lt;BR /&gt;VAR ReferenceDate = max('D Kalender'[Dato]) // selected date&lt;BR /&gt;VAR PreviousDates =&lt;BR /&gt;DATESINPERIOD(&lt;BR /&gt;'D Kalender Previous'[Dato],&lt;BR /&gt;ReferenceDate, // fra selected date&lt;BR /&gt;-13, // til 13 måneder tilbake&lt;BR /&gt;MONTH&lt;BR /&gt;)&lt;BR /&gt;VAR Result =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;[Actuals],&lt;BR /&gt;REMOVEFILTERS('D Kalender'),&lt;BR /&gt;KEEPFILTERS(PreviousDates),&lt;BR /&gt;USERELATIONSHIP('D Kalender'[TID_ID], 'D Kalender Previous'[TID_ID]) &lt;BR /&gt;)&lt;BR /&gt;Return&lt;BR /&gt;Result&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Now I want that to create a new measure which calculates the rolling average for the last 12 months for those values, so that I can add that as a line to the same visual. But when I try to calculate that, I don't get the result I want to achieve.&lt;BR /&gt;&lt;BR /&gt;I've tried now to use the following formule&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Actuals 12 mnd rullerende snitt avhanging av actuals siste 2 års = &lt;BR /&gt;VAR NumOfMonths = 12&lt;BR /&gt;VAR SelectedDate = MAX('D Kalender Previous'[Dato])&lt;BR /&gt;VAR Period = DATESINPERIOD(&lt;BR /&gt;'D Kalender Previous'[Dato], SelectedDate, -NumOfMonths, MONTH)&lt;BR /&gt;VAR StartDate = FIRSTDATE(Period)&lt;BR /&gt;VAR Result = &lt;BR /&gt;AVERAGEX(Period, &lt;BR /&gt;CALCULATE(&lt;BR /&gt;[Actuals],&lt;BR /&gt;REMOVEFILTERS('D Kalender'),&lt;BR /&gt;KEEPFILTERS(Period),&lt;BR /&gt;USERELATIONSHIP('D Kalender'[TID_ID], 'D Kalender Previous'[TID_ID]))&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;Result&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With as result for each MonthYear the values of the actuals in stead of the rolling average for the last 12 months.&lt;BR /&gt;So I get now this:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;MonthYear ('D Kalender Previous')&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Result measure Actuals 12 mnd rullerende snitt...&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202301&lt;/TD&gt;&lt;TD&gt;34&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202302&lt;/TD&gt;&lt;TD&gt;31&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202303&lt;/TD&gt;&lt;TD&gt;53&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202304&lt;/TD&gt;&lt;TD&gt;39&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202305&lt;/TD&gt;&lt;TD&gt;36&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But I had expected, and I want to achieve&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;MonthYear ('D Kalender Previous')&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Result measure Actuals 12 mnd rullerende snitt...&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202301&lt;/TD&gt;&lt;TD&gt;average of actuals for months 202202 to 202301&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202302&lt;/TD&gt;&lt;TD&gt;average of actuals for months 202203 to 202302&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202303&lt;/TD&gt;&lt;TD&gt;average of actuals for months 202204 to 202303&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202304&lt;/TD&gt;&lt;TD&gt;average of actuals for months 202205 to 202304&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202305&lt;/TD&gt;&lt;TD&gt;average of actuals for months 202206 to 202305&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How can I achieve this? I hope that someone can help me.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2023 11:48:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-rolling-average-based-on-a-expression-and-connection/m-p/3338532#M125252</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-07-20T11:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling average based on a expression and connection with a second data table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-rolling-average-based-on-a-expression-and-connection/m-p/3338703#M125267</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;I would suggest, if you are not already, saw link related to this topic, rolling average as I do not understand your measure (I tried to figure out but no luck :))&lt;/P&gt;&lt;P&gt;One tip based on experience: only have one Date table, otherwise complexity is created sooner or later.&lt;/P&gt;&lt;P&gt;Hope this help.&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/rolling-12-months-average-in-dax/" target="_self"&gt;https://www.sqlbi.com/articles/rolling-12-months-average-in-dax/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 13:25:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-rolling-average-based-on-a-expression-and-connection/m-p/3338703#M125267</guid>
      <dc:creator>some_bih</dc:creator>
      <dc:date>2023-07-19T13:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling average based on a expression and connection with a second data table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-rolling-average-based-on-a-expression-and-connection/m-p/3340728#M125382</link>
      <description>&lt;P&gt;Unfortunately that doesn't work :(. I use the technique with 2 Date tables based on this video&amp;nbsp;&lt;A href="https://www.youtube.com/watch?v=d8Rm7dwM6gc" target="_blank"&gt;https://www.youtube.com/watch?v=d8Rm7dwM6gc&lt;/A&gt;. Maybe after you have seen this, you can help me?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2023 11:50:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-rolling-average-based-on-a-expression-and-connection/m-p/3340728#M125382</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-07-20T11:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling average based on a expression and connection with a second data table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-rolling-average-based-on-a-expression-and-connection/m-p/3340787#M125386</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;I will watch and share my findings.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2023 12:12:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-rolling-average-based-on-a-expression-and-connection/m-p/3340787#M125386</guid>
      <dc:creator>some_bih</dc:creator>
      <dc:date>2023-07-20T12:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating rolling average based on a expression and connection with a second data table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-rolling-average-based-on-a-expression-and-connection/m-p/3345312#M125588</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;I still believe that you should follow my suggestion for Average (it could be a lot to rework). Still, if you really want to follow solution you link to youtube, then just follow logic in download section for that article.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It could be that I do not helping you, but model is really everything in DAX / power bi solutions.&lt;/P&gt;</description>
      <pubDate>Sun, 23 Jul 2023 17:48:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-rolling-average-based-on-a-expression-and-connection/m-p/3345312#M125588</guid>
      <dc:creator>some_bih</dc:creator>
      <dc:date>2023-07-23T17:48:27Z</dc:date>
    </item>
  </channel>
</rss>

