<?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: Average values of a column within the week before with conditions in the month before in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-values-of-a-column-within-the-week-before-with/m-p/3692945#M143556</link>
    <description>&lt;P&gt;Please provide sample data that covers your issue or question &lt;STRONG&gt;completely&lt;/STRONG&gt;, in a &lt;STRONG&gt;usable&lt;/STRONG&gt; format (not as a screenshot).&lt;BR /&gt;&lt;BR /&gt;Do not include sensitive information or anything not related to the issue or question. &lt;BR /&gt;&lt;BR /&gt;If you are unsure how to upload data please refer to &lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;Please show the expected outcome based on the sample data you provided. &lt;BR /&gt;&lt;BR /&gt;Want faster answers? &lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 11 Feb 2024 19:43:01 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2024-02-11T19:43:01Z</dc:date>
    <item>
      <title>Average values of a column within the week before with conditions in the month before</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-values-of-a-column-within-the-week-before-with/m-p/3692862#M143551</link>
      <description>&lt;P&gt;I have a table '&lt;STRONG&gt;TableSales&lt;/STRONG&gt;' with 3 columns 'Date' (in date format), 'Cashier', 'Sale Amount', and another table '&lt;STRONG&gt;TableDate&lt;/STRONG&gt;' with 2 columns 'SelectedDate' (in date format) and 'SelectedDate_text' (date but in text format so that I can have the last date as "The latest day" instead of the date).&lt;/P&gt;&lt;P&gt;I use '&lt;STRONG&gt;TableDate&lt;/STRONG&gt;'[SelectedDate_Text] to create a slicer so that users can choose a desired date.&lt;/P&gt;&lt;P&gt;I would like to create a measure to calculate the average Sale Amount of Cashiers per day during the latest 7 days until the selected date in the slicer. I can do that with the following query:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;average = CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SUM('TableSales'[Sale Amount])/COUNT('&lt;SPAN&gt;TableSales'[Cashiers])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ,FILTER('TableSales',&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'TableSales'[Date &amp;lt;= MAX('TableDate'[SelectedDate])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;amp;&amp;amp;&amp;nbsp;'TableSales'[Date &amp;gt;= MAX('TableDate'[SelectedDate])-6))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, now I want to filter out all Cashiers with Sale Amount = 0 or blank during the latest 1 month until the selected date because those cashiers are assumed to be broken and shouldn't be taken into the calculation of average. How should I include that into my measure? Thank you.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Feb 2024 16:50:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-values-of-a-column-within-the-week-before-with/m-p/3692862#M143551</guid>
      <dc:creator>liselotte</dc:creator>
      <dc:date>2024-02-11T16:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Average values of a column within the week before with conditions in the month before</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-values-of-a-column-within-the-week-before-with/m-p/3692887#M143554</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="688542" data-lia-user-login="liselotte" class="lia-mention lia-mention-user"&gt;liselotte&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;not sure but try to below measure&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;average = 
var a = selectedvalue('TableDate'[SelectedDate])
var a1 = edate(selectedvalue('TableDate'[SelectedDate]),-1)
return
CALCULATE(
      SUM('TableSales'[Sale Amount])/COUNT('TableSales'[Cashiers])
      ,FILTER(
          filter(
              'TableSales',
              'TableSales'[Date] &amp;gt;= a1 &amp;amp;&amp;amp;
              'TableSales'[Date]=&amp;lt; a &amp;amp;&amp;amp; 
              'TableSales'[Sale Amount])&amp;lt;&amp;gt; blank()
          )
          'TableSales'[Date] &amp;lt;= MAX('TableDate'[SelectedDate]) &amp;amp;&amp;amp;
          'TableSales'[Date &amp;gt;= MAX('TableDate'[SelectedDate])-6
       )
)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Feb 2024 17:46:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-values-of-a-column-within-the-week-before-with/m-p/3692887#M143554</guid>
      <dc:creator>Dangar332</dc:creator>
      <dc:date>2024-02-11T17:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: Average values of a column within the week before with conditions in the month before</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-values-of-a-column-within-the-week-before-with/m-p/3692945#M143556</link>
      <description>&lt;P&gt;Please provide sample data that covers your issue or question &lt;STRONG&gt;completely&lt;/STRONG&gt;, in a &lt;STRONG&gt;usable&lt;/STRONG&gt; format (not as a screenshot).&lt;BR /&gt;&lt;BR /&gt;Do not include sensitive information or anything not related to the issue or question. &lt;BR /&gt;&lt;BR /&gt;If you are unsure how to upload data please refer to &lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;Please show the expected outcome based on the sample data you provided. &lt;BR /&gt;&lt;BR /&gt;Want faster answers? &lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Feb 2024 19:43:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-values-of-a-column-within-the-week-before-with/m-p/3692945#M143556</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-02-11T19:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: Average values of a column within the week before with conditions in the month before</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-values-of-a-column-within-the-week-before-with/m-p/3694043#M143628</link>
      <description>&lt;P&gt;Thank you for your reply, but your provided query will remove all rows with blank Sale Amounts durinh the latest month while what I want is to only remove rows with Cashiers having all Sale Amounts = 0 or blank during the latest month. For Cashiers having sometimes Sale Amount &amp;lt;&amp;gt; 0 during the latest month, even the rows of them with Sale Amount = 0 should be kept in the data to calculate the average.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2024 12:43:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-values-of-a-column-within-the-week-before-with/m-p/3694043#M143628</guid>
      <dc:creator>liselotte</dc:creator>
      <dc:date>2024-02-12T12:43:24Z</dc:date>
    </item>
  </channel>
</rss>

