<?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: Issue with rolling average based off item type in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-rolling-average-based-off-item-type/m-p/4359419#M173067</link>
    <description>&lt;P&gt;Thanks, I was able to figure this out based on the video. I needed to change my formula. Each time I listed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Query1'[CompletedDateSK]&lt;/LI-CODE&gt;&lt;P&gt;I needed to change it to&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Query1'[CompletedDateSK].[Date]&lt;/LI-CODE&gt;&lt;P&gt;That correctly calculated a 90 day average. Then I created 3 measurements and got them all displayed correctly&lt;/P&gt;</description>
    <pubDate>Fri, 10 Jan 2025 22:27:52 GMT</pubDate>
    <dc:creator>JohnFabric</dc:creator>
    <dc:date>2025-01-10T22:27:52Z</dc:date>
    <item>
      <title>Issue with rolling average based off item type</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-rolling-average-based-off-item-type/m-p/4357989#M173000</link>
      <description>&lt;P&gt;Hello, I'm looking to create a rolling 90 day/3 month average of LeadTime over the course of a year. This is what my data looks like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The issue with this is I have three different WorkItemType values: "Task", "Feature" and "PBI" so even though all the data is in a single table, I need three different rolling averages, one per type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The DAX I have so far is for a single type, Feature. I assume I will need 3 measurements in total, one for each.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Rolling Average = VAR LastTransactionDate = MAX('Query1'[CompletedDateSK])
VAR AverageDay = 90
VAR PeriodInVisual = 
FILTER(
    ALL(
        'Query1'[CompletedDateSK]
    ),
    AND(
        'Query1'[CompletedDateSK] &amp;gt; LastTransactionDate - AverageDay,
        'Query1'[CompletedDateSK] &amp;lt;= LastTransactionDate
    )
)
VAR WorkItemType =
FILTER(
    ALL(
        'Query1'[WorkItemType]
    ),
    AND(
        'Query1'[WorkItemType] = "Feature",
        'Query1'[WorkItemType] = "Feature"
    )
)
VAR OutPut =
CALCULATE(
    AVERAGEX(
        'Query1',
        [LeadTimeDays]
    ),
    PeriodInVisual, WorkItemType
)
RETURN
OutPut&lt;/LI-CODE&gt;&lt;P&gt;Which feels like it can be improved. I'm also not sure it is calculating the right values either, since the rolling average is being calculcated as the same as the month average&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;How can I calculate rolling average correctly given my data?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 01:31:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-rolling-average-based-off-item-type/m-p/4357989#M173000</guid>
      <dc:creator>JohnFabric</dc:creator>
      <dc:date>2025-01-10T01:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with rolling average based off item type</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-rolling-average-based-off-item-type/m-p/4358025#M173003</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="798731" data-lia-user-login="JohnFabric" class="lia-mention lia-mention-user"&gt;JohnFabric&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This reference shows how to use concat to check if the moving average is calculated as expected.&lt;BR /&gt;&lt;A href="https://www.youtube.com/watch?v=FLjygam5x-I&amp;amp;t=584s" target="_blank" rel="noopener"&gt;How to Calculate Moving Averages in Power BI - The Ultimate Guide&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can modify the "Dates in period" part of the DAX code to put in the required MA period.&lt;/P&gt;
&lt;P&gt;Lastly, if you apply a visual level filter using Workitem Type&amp;nbsp; on the matrix, you could have 3 visuals filtered with the same DAX code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hope this helps. let me know if this resolves the issue.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if it doesn't, kindly upload a sample input (masking sensitive information)&amp;nbsp; in a usable format such as table, csv, excel etc. and a sample output.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 02:03:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-rolling-average-based-off-item-type/m-p/4358025#M173003</guid>
      <dc:creator>adudani</dc:creator>
      <dc:date>2025-01-10T02:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with rolling average based off item type</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-rolling-average-based-off-item-type/m-p/4359419#M173067</link>
      <description>&lt;P&gt;Thanks, I was able to figure this out based on the video. I needed to change my formula. Each time I listed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Query1'[CompletedDateSK]&lt;/LI-CODE&gt;&lt;P&gt;I needed to change it to&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Query1'[CompletedDateSK].[Date]&lt;/LI-CODE&gt;&lt;P&gt;That correctly calculated a 90 day average. Then I created 3 measurements and got them all displayed correctly&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 22:27:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-rolling-average-based-off-item-type/m-p/4359419#M173067</guid>
      <dc:creator>JohnFabric</dc:creator>
      <dc:date>2025-01-10T22:27:52Z</dc:date>
    </item>
  </channel>
</rss>

