<?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: 4 Week Average with a Day Filter in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/4-Week-Average-with-a-Day-Filter/m-p/3684593#M143116</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thank you for your message.&lt;/P&gt;
&lt;P&gt;Please check the below and the attached pbix file if it suits your requirement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;4 Week Average = 
VAR _fourweekstable =
    WINDOW (
        -3,
        REL,
        0,
        REL,
        SUMMARIZE ( ALL ( 'PpOH Request from Harold' ), 'Calendar'[Week Ending Date] ),
        ORDERBY ( 'Calendar'[Week Ending Date], ASC )
    )
VAR _condition =
    COUNTROWS ( _fourweekstable ) = 4
RETURN
    IF (
        _condition,
        AVERAGEX (
            _fourweekstable,
            CALCULATE ( SUM ( 'PpOH Request from Harold'[PatronHours] ) )
        )
    )&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 07 Feb 2024 04:34:47 GMT</pubDate>
    <dc:creator>Jihwan_Kim</dc:creator>
    <dc:date>2024-02-07T04:34:47Z</dc:date>
    <item>
      <title>4 Week Average with a Day Filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/4-Week-Average-with-a-Day-Filter/m-p/3681917#M142990</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I am hoping to create a 4 Week average which can be changed based off a day slicer. For example if the Slicer is on a Monday then it would show average for the last 4 mondays etc. I have had a look at the previous forums however, because my data requires to be summed then averaged I am having issues. Apologies for the screenshots in advance.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 05:19:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/4-Week-Average-with-a-Day-Filter/m-p/3681917#M142990</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-06T05:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: 4 Week Average with a Day Filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/4-Week-Average-with-a-Day-Filter/m-p/3681999#M142994</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/window-function-dax?wt.mc_id=DP-MVP-5004989" target="_blank"&gt;WINDOW function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sales measure: = 
SUM( Sales[Sales] )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Expected result measure: =
VAR _currentdayname =
    MAX ( 'Calendar'[Day name sort] )
VAR _currentdate =
    MAX ( 'Calendar'[Date] )
VAR _recentfoursamedaytable =
    WINDOW (
        1,
        ABS,
        4,
        ABS,
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[Date] &amp;lt;= _currentdate
                &amp;amp;&amp;amp; 'Calendar'[Day name sort] = _currentdayname
        ),
        ORDERBY ( 'Calendar'[Date], ASC )
    )
VAR _condition =
    COUNTROWS ( _recentfoursamedaytable ) = 4
RETURN
    IF ( _condition, AVERAGEX ( _recentfoursamedaytable, [Sales measure:] ) )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 06:01:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/4-Week-Average-with-a-Day-Filter/m-p/3681999#M142994</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2024-02-06T06:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: 4 Week Average with a Day Filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/4-Week-Average-with-a-Day-Filter/m-p/3682005#M142996</link>
      <description>&lt;P&gt;Hi Jihwan_Kim, really appreciate it for responding. I am still having issues given that I am having to sum the patron hours for the day before averaging it, as the data I have is based on an hourly/location basis.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 06:06:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/4-Week-Average-with-a-Day-Filter/m-p/3682005#M142996</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-06T06:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: 4 Week Average with a Day Filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/4-Week-Average-with-a-Day-Filter/m-p/3682024#M142997</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please provide a sample pbix file with how the expected outcome looks like.&lt;/P&gt;
&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 06:16:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/4-Week-Average-with-a-Day-Filter/m-p/3682024#M142997</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2024-02-06T06:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: 4 Week Average with a Day Filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/4-Week-Average-with-a-Day-Filter/m-p/3684191#M143090</link>
      <description>&lt;P&gt;Hi Jihwan_Kim&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've attached it here&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1fC-Z7UIfen1OZiedW1kMzYUuU8K_XZx4/view?usp=drivesdk" target="_blank"&gt;https://drive.google.com/file/d/1fC-Z7UIfen1OZiedW1kMzYUuU8K_XZx4/view?usp=drivesdk&lt;/A&gt;&lt;/P&gt;&lt;P&gt;thanks again!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 22:34:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/4-Week-Average-with-a-Day-Filter/m-p/3684191#M143090</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-06T22:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: 4 Week Average with a Day Filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/4-Week-Average-with-a-Day-Filter/m-p/3684593#M143116</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thank you for your message.&lt;/P&gt;
&lt;P&gt;Please check the below and the attached pbix file if it suits your requirement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;4 Week Average = 
VAR _fourweekstable =
    WINDOW (
        -3,
        REL,
        0,
        REL,
        SUMMARIZE ( ALL ( 'PpOH Request from Harold' ), 'Calendar'[Week Ending Date] ),
        ORDERBY ( 'Calendar'[Week Ending Date], ASC )
    )
VAR _condition =
    COUNTROWS ( _fourweekstable ) = 4
RETURN
    IF (
        _condition,
        AVERAGEX (
            _fourweekstable,
            CALCULATE ( SUM ( 'PpOH Request from Harold'[PatronHours] ) )
        )
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 07 Feb 2024 04:34:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/4-Week-Average-with-a-Day-Filter/m-p/3684593#M143116</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2024-02-07T04:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: 4 Week Average with a Day Filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/4-Week-Average-with-a-Day-Filter/m-p/3712608#M144452</link>
      <description>&lt;P&gt;Hi Jihwan_Kim,&lt;BR /&gt;&lt;BR /&gt;Just wanted to say thank you as it worked perfectly. However because the data file is so big I have moved to a DirectQuery from Big Query. I am now getting this issue&amp;nbsp;The column 'Week Ending Date1' specified in the 'SUMMARIZE' function was not found in the input table. What would a workaround be?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 01:05:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/4-Week-Average-with-a-Day-Filter/m-p/3712608#M144452</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-21T01:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: 4 Week Average with a Day Filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/4-Week-Average-with-a-Day-Filter/m-p/3712944#M144474</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;In the case of having weak relationship (between direct query table and import table), summarize dax function does not work. Summarize dax function works well under strong relationship.&lt;/P&gt;
&lt;P&gt;Summarize is just one of many dax functions that describes the outcome as table.&lt;/P&gt;
&lt;P&gt;In this case, use other dax functions that construct tables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/table-manipulation-functions-dax?wt.mc_id=DP-MVP-5004989" target="_blank"&gt;Table manipulation functions (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 03:59:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/4-Week-Average-with-a-Day-Filter/m-p/3712944#M144474</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2024-02-21T03:59:34Z</dc:date>
    </item>
  </channel>
</rss>

