<?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 Filter a Fact Table to Exclude Item Exceptions By Date Range in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-a-Fact-Table-to-Exclude-Item-Exceptions-By-Date-Range/m-p/3133971#M111617</link>
    <description>&lt;P&gt;I have a list of transactions by Date and Item (multiple dates and items) and now I need to exclude certain items based on the date ranges in this second table.&lt;BR /&gt;(items can appear multiple times - item A is offline between 1/1/2023 and 1/4/2023, but also item A is offline 2/15/2023-2/16/2023)&lt;/P&gt;&lt;P&gt;If the transaction date, for that item appears in one of these entries, it needs to be flagged 1, otherwise 0.&lt;/P&gt;&lt;P&gt;...I did set up an inactive many to many relationship on item ID, so I could call upon item IDs to match them, but filtering between the date fields is tricky.&lt;/P&gt;&lt;P&gt;... also, i do have a date table in this model&lt;/P&gt;</description>
    <pubDate>Wed, 15 Mar 2023 16:10:11 GMT</pubDate>
    <dc:creator>RGregory</dc:creator>
    <dc:date>2023-03-15T16:10:11Z</dc:date>
    <item>
      <title>Filter a Fact Table to Exclude Item Exceptions By Date Range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-a-Fact-Table-to-Exclude-Item-Exceptions-By-Date-Range/m-p/3133971#M111617</link>
      <description>&lt;P&gt;I have a list of transactions by Date and Item (multiple dates and items) and now I need to exclude certain items based on the date ranges in this second table.&lt;BR /&gt;(items can appear multiple times - item A is offline between 1/1/2023 and 1/4/2023, but also item A is offline 2/15/2023-2/16/2023)&lt;/P&gt;&lt;P&gt;If the transaction date, for that item appears in one of these entries, it needs to be flagged 1, otherwise 0.&lt;/P&gt;&lt;P&gt;...I did set up an inactive many to many relationship on item ID, so I could call upon item IDs to match them, but filtering between the date fields is tricky.&lt;/P&gt;&lt;P&gt;... also, i do have a date table in this model&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 16:10:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-a-Fact-Table-to-Exclude-Item-Exceptions-By-Date-Range/m-p/3133971#M111617</guid>
      <dc:creator>RGregory</dc:creator>
      <dc:date>2023-03-15T16:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Filter a Fact Table to Exclude Item Exceptions By Date Range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-a-Fact-Table-to-Exclude-Item-Exceptions-By-Date-Range/m-p/3134113#M111629</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="293073" data-lia-user-login="RGregory" class="lia-mention lia-mention-user"&gt;RGregory&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Create a separate table for the exclusion dates with columns for Item, Start Date, and End Date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Create a measure that calculates whether a transaction falls within any of the exclusion date ranges for the item.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Transaction Flag = 
VAR ItemID = MAX('Transactions'[Item ID])
VAR TransactionDate = MAX('Transactions'[Transaction Date])
VAR Exclusions = FILTER(ExclusionDates, ExclusionDates[Item] = ItemID &amp;amp;&amp;amp; TransactionDate &amp;gt;= ExclusionDates[Start Date] &amp;amp;&amp;amp; TransactionDate &amp;lt;= ExclusionDates[End Date])
RETURN IF(COUNTROWS(Exclusions) &amp;gt; 0, 1, 0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Add the Transaction Flag measure to your visualizations to see which transactions are flagged based on the exclusion dates.&lt;/P&gt;&lt;P&gt;4. You can also use the measure to filter your data by creating a filter that includes only transactions with a flag of 0 (i.e., transactions that are not excluded).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if you might require further assistance.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 17:06:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-a-Fact-Table-to-Exclude-Item-Exceptions-By-Date-Range/m-p/3134113#M111629</guid>
      <dc:creator>Sahir_Maharaj</dc:creator>
      <dc:date>2023-03-15T17:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: Filter a Fact Table to Exclude Item Exceptions By Date Range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-a-Fact-Table-to-Exclude-Item-Exceptions-By-Date-Range/m-p/3134364#M111657</link>
      <description>&lt;P&gt;Very helpful! Thank you.&lt;BR /&gt;&lt;BR /&gt;I was trying to create this as a calculated column, and doing it the way prescribed above does not work on column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead, I used the steps above to create the Flag as a measure, then used some DAX on column to tie them together.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 19:17:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-a-Fact-Table-to-Exclude-Item-Exceptions-By-Date-Range/m-p/3134364#M111657</guid>
      <dc:creator>RGregory</dc:creator>
      <dc:date>2023-03-15T19:17:24Z</dc:date>
    </item>
  </channel>
</rss>

