<?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 Calculating average based on range of dates in another table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-average-based-on-range-of-dates-in-another-table/m-p/2931168#M96425</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have issues with figuring out how to calculate average of values for a fiscal year based on two date columns that are in another table.&lt;/P&gt;&lt;P&gt;There are 3 tables total:&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; Department Name, Date, Start Date, End Date.&lt;/P&gt;&lt;P&gt;Columns Start and End date are a range of a fiscal year. Each department has a different start and end dates of a fiscal year.&lt;/P&gt;&lt;P&gt;There is one row for every month available for each department.&lt;/P&gt;&lt;P&gt;Table 1 filters table 2, many to many relationship from Department to Department Name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; Department Name, Date, Average of Values.&lt;/P&gt;&lt;P&gt;There is one row for every month available for each department.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Calendar table which filters table no. 2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote a following calculation but it obviously doesn't work with fiscal year dates being in a different table:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;AVERAGE&lt;/SPAN&gt;&lt;SPAN&gt;('Monthly value'[MonthAVG]), &lt;/SPAN&gt;&lt;SPAN&gt;DATESBETWEEN&lt;/SPAN&gt;&lt;SPAN&gt;('Calendar'[Date]&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;[Date], &lt;/SPAN&gt;&lt;SPAN&gt;MIN&lt;/SPAN&gt;&lt;SPAN&gt;('Months with FY'[FYFrom]), &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;('Months with FY'[FYTo])))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I tried adding a column to table 1 to include average of monthly value from table 2, but I failed to do that with RELATED. I tried adding inactive relationships between two tables but can't find a working configuration with USERELATIONSHIP.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Basically I try to create a measure that will display average for an entire fiscal year for a given department if a date within that fiscal year range is selected on a slicer. For example : Fiscal year is 05.2021 - 04.2022; if a user selects any month in that range a measure will display an average for an entire year.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Sun, 27 Nov 2022 13:36:15 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-11-27T13:36:15Z</dc:date>
    <item>
      <title>Calculating average based on range of dates in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-average-based-on-range-of-dates-in-another-table/m-p/2931168#M96425</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have issues with figuring out how to calculate average of values for a fiscal year based on two date columns that are in another table.&lt;/P&gt;&lt;P&gt;There are 3 tables total:&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; Department Name, Date, Start Date, End Date.&lt;/P&gt;&lt;P&gt;Columns Start and End date are a range of a fiscal year. Each department has a different start and end dates of a fiscal year.&lt;/P&gt;&lt;P&gt;There is one row for every month available for each department.&lt;/P&gt;&lt;P&gt;Table 1 filters table 2, many to many relationship from Department to Department Name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; Department Name, Date, Average of Values.&lt;/P&gt;&lt;P&gt;There is one row for every month available for each department.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Calendar table which filters table no. 2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote a following calculation but it obviously doesn't work with fiscal year dates being in a different table:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;AVERAGE&lt;/SPAN&gt;&lt;SPAN&gt;('Monthly value'[MonthAVG]), &lt;/SPAN&gt;&lt;SPAN&gt;DATESBETWEEN&lt;/SPAN&gt;&lt;SPAN&gt;('Calendar'[Date]&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;[Date], &lt;/SPAN&gt;&lt;SPAN&gt;MIN&lt;/SPAN&gt;&lt;SPAN&gt;('Months with FY'[FYFrom]), &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;('Months with FY'[FYTo])))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I tried adding a column to table 1 to include average of monthly value from table 2, but I failed to do that with RELATED. I tried adding inactive relationships between two tables but can't find a working configuration with USERELATIONSHIP.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Basically I try to create a measure that will display average for an entire fiscal year for a given department if a date within that fiscal year range is selected on a slicer. For example : Fiscal year is 05.2021 - 04.2022; if a user selects any month in that range a measure will display an average for an entire year.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 27 Nov 2022 13:36:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-average-based-on-range-of-dates-in-another-table/m-p/2931168#M96425</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-27T13:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating average based on range of dates in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-average-based-on-range-of-dates-in-another-table/m-p/2931742#M96462</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , I think this can help &lt;/P&gt;
&lt;P&gt;Average of Rolling, Average of Snapshots: &lt;A href="https://youtu.be/_pZRdLAJxxA" target="_blank"&gt;https://youtu.be/_pZRdLAJxxA&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2022 03:33:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-average-based-on-range-of-dates-in-another-table/m-p/2931742#M96462</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-11-28T03:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating average based on range of dates in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-average-based-on-range-of-dates-in-another-table/m-p/2933911#M96604</link>
      <description>&lt;P&gt;Hi, thanks for that. Unfortunately I was not able to find a working way of connecting those two tables together. I understand it is a matter of creating a correct inactive relationship between dates columns. I tried including userelationships in formula but to no avail. I am not able to find a proper way to have this calculation include a part that would allow for it to get filtered by my calendar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attach a screenshot of a model. I tried playing with inactive relationships beween calendar date and FYFrom, FYTo, MM-YYYY&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2022 21:02:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-average-based-on-range-of-dates-in-another-table/m-p/2933911#M96604</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-28T21:02:01Z</dc:date>
    </item>
  </channel>
</rss>

