<?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 Measure - Filter based on different table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-Filter-based-on-different-table/m-p/2829213#M90057</link>
    <description>&lt;P&gt;Hi experts!&lt;/P&gt;
&lt;P&gt;I have a sales table and an order table.&lt;/P&gt;
&lt;P&gt;Simple tables that contains article, date and value. Both tables are linked to a calendar table.&lt;/P&gt;
&lt;P&gt;Sales&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;Article&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;Date&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;Value&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;A&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;01.10.2022&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;500&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Order&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="25%"&gt;Article&lt;/TD&gt;
&lt;TD width="25%"&gt;Date&lt;/TD&gt;
&lt;TD width="25%"&gt;Value&lt;/TD&gt;
&lt;TD width="25%"&gt;Shared Date (Year-Week)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%"&gt;A&lt;/TD&gt;
&lt;TD width="25%"&gt;01.11.2022&lt;/TD&gt;
&lt;TD width="25%"&gt;500&lt;/TD&gt;
&lt;TD width="25%"&gt;2022-39&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;15.01.2022&lt;/TD&gt;
&lt;TD&gt;600&lt;/TD&gt;
&lt;TD&gt;2022-40&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is a slicer on the report page with "Shared Date". Now I would like to sum up the sales for the selected time horizon (Shared Date) including the next 4 weeks.&lt;/P&gt;
&lt;P&gt;If I select 2022-39, then I would like to get the sales for 2022-39,&amp;nbsp;2022-40, 2022-41,&amp;nbsp;2022-42,&amp;nbsp;2022-43.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How would you do that in DAX?&lt;/P&gt;</description>
    <pubDate>Sun, 09 Oct 2022 17:25:54 GMT</pubDate>
    <dc:creator>joshua1990</dc:creator>
    <dc:date>2022-10-09T17:25:54Z</dc:date>
    <item>
      <title>Measure - Filter based on different table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-Filter-based-on-different-table/m-p/2829213#M90057</link>
      <description>&lt;P&gt;Hi experts!&lt;/P&gt;
&lt;P&gt;I have a sales table and an order table.&lt;/P&gt;
&lt;P&gt;Simple tables that contains article, date and value. Both tables are linked to a calendar table.&lt;/P&gt;
&lt;P&gt;Sales&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;Article&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;Date&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;Value&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;A&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;01.10.2022&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;500&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Order&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="25%"&gt;Article&lt;/TD&gt;
&lt;TD width="25%"&gt;Date&lt;/TD&gt;
&lt;TD width="25%"&gt;Value&lt;/TD&gt;
&lt;TD width="25%"&gt;Shared Date (Year-Week)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%"&gt;A&lt;/TD&gt;
&lt;TD width="25%"&gt;01.11.2022&lt;/TD&gt;
&lt;TD width="25%"&gt;500&lt;/TD&gt;
&lt;TD width="25%"&gt;2022-39&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;15.01.2022&lt;/TD&gt;
&lt;TD&gt;600&lt;/TD&gt;
&lt;TD&gt;2022-40&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is a slicer on the report page with "Shared Date". Now I would like to sum up the sales for the selected time horizon (Shared Date) including the next 4 weeks.&lt;/P&gt;
&lt;P&gt;If I select 2022-39, then I would like to get the sales for 2022-39,&amp;nbsp;2022-40, 2022-41,&amp;nbsp;2022-42,&amp;nbsp;2022-43.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How would you do that in DAX?&lt;/P&gt;</description>
      <pubDate>Sun, 09 Oct 2022 17:25:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-Filter-based-on-different-table/m-p/2829213#M90057</guid>
      <dc:creator>joshua1990</dc:creator>
      <dc:date>2022-10-09T17:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Measure - Filter based on different table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-Filter-based-on-different-table/m-p/2830038#M90125</link>
      <description>&lt;P&gt;please try these steps&lt;/P&gt;
&lt;P&gt;1, add a column in the calendar table, Year-Week&lt;/P&gt;
&lt;P&gt;2, create a measure&lt;/P&gt;
&lt;P&gt;=VAR _yw=selectedvalue(orders[Shared Date(Year_Week)])&lt;/P&gt;
&lt;P&gt;VAR _selectedweeks=topn(4,filter(allselected(calendar[year-week]),calendar[year-week]&amp;gt;=_yw),calendar[year-week],ASC)&lt;/P&gt;
&lt;P&gt;return&lt;/P&gt;
&lt;P&gt;calculate(sum(Sales[Value]),treatas(_selectedweeks,calendar[year-week]))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 06:39:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-Filter-based-on-different-table/m-p/2830038#M90125</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2022-10-10T06:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: Measure - Filter based on different table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-Filter-based-on-different-table/m-p/2831225#M90205</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="264353" data-lia-user-login="wdx223_Daniel" class="lia-mention lia-mention-user"&gt;wdx223_Daniel&lt;/a&gt;&amp;nbsp;: That works perfectly fine! Thanks.&lt;/P&gt;
&lt;P&gt;Is it possible to display/ split this result for the weekly aggregation? Maybe using a second calendar table?&lt;/P&gt;
&lt;P&gt;I would like to see the sum per week.&lt;/P&gt;
&lt;P&gt;If I use a second calendar table, then I get the correct values per week. But every other week is also displayed but with a 0&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 13:45:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-Filter-based-on-different-table/m-p/2831225#M90205</guid>
      <dc:creator>joshua1990</dc:creator>
      <dc:date>2022-10-10T13:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: Measure - Filter based on different table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-Filter-based-on-different-table/m-p/2832332#M90259</link>
      <description>&lt;P&gt;try these steps&lt;/P&gt;
&lt;P&gt;1, add a new dimension table, say YearWeek, as the slicer table with no relationships.&lt;/P&gt;
&lt;P&gt;YearWeek=Values(&lt;SPAN&gt;orders[Shared Date(Year_Week)])&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2, put the calendar[Year-Week] on the visual, and amend the meausre&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;=VAR _yw=selectedvalue(YearWeek[Shared Date(Year_Week)])&lt;/P&gt;
&lt;P&gt;VAR _selectedweeks=topn(4,filter(allselected(calendar[year-week]),calendar[year-week]&amp;gt;=_yw),calendar[year-week],ASC)&lt;/P&gt;
&lt;P&gt;return&lt;/P&gt;
&lt;P&gt;if(max(calendar[year-week]) IN _selectedweeks,sum(Sales[Value]))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 00:15:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-Filter-based-on-different-table/m-p/2832332#M90259</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2022-10-11T00:15:23Z</dc:date>
    </item>
  </channel>
</rss>

