<?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: How to use DAX to filter rows in table based on a date slicer in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-DAX-to-filter-rows-in-table-based-on-a-date-slicer/m-p/3991262#M154815</link>
    <description>&lt;P&gt;I've provided DDL at the bottom of my question and the expected results in the bullet points below the screenshot in the question.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jun 2024 13:50:31 GMT</pubDate>
    <dc:creator>MrHajiCoolBreez</dc:creator>
    <dc:date>2024-06-13T13:50:31Z</dc:date>
    <item>
      <title>How to use DAX to filter rows in table based on a date slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-DAX-to-filter-rows-in-table-based-on-a-date-slicer/m-p/3988396#M154608</link>
      <description>&lt;P&gt;I'm new to PBI and DAX.&lt;/P&gt;&lt;P&gt;I've inherited a PBI report that uses the &lt;A href="https://appsource.microsoft.com/en-us/product/power-bi-visuals/WA104380786?tab=Overview" target="_self"&gt;MS timeline slicer&lt;/A&gt; custom visual.&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;The problem I'm trying to resolve is to only show data in a table where any period inside the date/date range selected falls within the StartDate and EndDate of a table of data.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Based on the following subset table of data...&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- If February 2024 was selected in the Timeline Slicer then only rows&amp;nbsp;with Id 1,2 would be shown.&lt;/P&gt;&lt;P&gt;- If July 2024 was selected in the Timeline Slicer then only rows with Id 2 would be shown.&lt;/P&gt;&lt;P&gt;- If September 2024 to January 2025 was selected in the Timeline Slicer then only rows with Id 3,4 would be shown.&lt;/P&gt;&lt;P&gt;- If January 2025 was selected in the Timeline Slicer then no rows would be shown.&lt;/P&gt;&lt;P&gt;- If Q1 2024 was selected in the Timeline Slicer then only rows&amp;nbsp;with Id 1,2 would be shown.&lt;/P&gt;&lt;P&gt;- If Q3 2024 was selected in the Timeline Slicer then only rows&amp;nbsp;with Id 4 would be shown.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Including a 1-2-many relationship between the `Calendar` and `Data` table isn't going to work here.&lt;BR /&gt;&lt;BR /&gt;I'm thinking the way to do would be to use measures.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;One that will hold the value of the `MIN` date selected, and another to hold the `MAX` date selected.&lt;/P&gt;&lt;P&gt;`SelectedMinDate = DATEVALUE(MIN('Calendar'[Date]))`&lt;/P&gt;&lt;P&gt;`SelectedMaxDate = DATEVALUE(MAX('Calendar'[Date]))`&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;But how I would use these to filter the result set in the table is where I get stuck.&amp;nbsp; These might&amp;nbsp; not be the correct measures in the first place.&lt;BR /&gt;&lt;/SPAN&gt;What do I need further?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This is the DDL for the sample data set&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;DROP TABLE IF EXISTS dbo.Test1&lt;BR /&gt;&lt;BR /&gt;CREATE TABLE dbo.Test1&lt;BR /&gt;(&lt;BR /&gt;Id INT IDENTITY(1,1) ,&lt;BR /&gt;Activity VARCHAR(255) ,&lt;BR /&gt;StartDate DATE ,&lt;BR /&gt;EndDate DATE&lt;BR /&gt;);&lt;BR /&gt;&lt;BR /&gt;INSERT INTO dbo.Test1&lt;BR /&gt;(Activity,StartDate,EndDate)&lt;BR /&gt;SELECT&lt;BR /&gt;T.Activity,&lt;BR /&gt;T.StartDate ,&lt;BR /&gt;T.EndDate&lt;BR /&gt;FROM (VALUES('Test1', '20240101', '20240430'),&lt;BR /&gt;('Test2', '20240301', '20240630'),&lt;BR /&gt;('Test3', '20240501', '20241031'),&lt;BR /&gt;('Test4', '20241101', '20241231')&lt;BR /&gt;) T(Activity,StartDate,EndDate)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 11:32:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-DAX-to-filter-rows-in-table-based-on-a-date-slicer/m-p/3988396#M154608</guid>
      <dc:creator>MrHajiCoolBreez</dc:creator>
      <dc:date>2024-06-12T11:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to use DAX to filter rows in table based on a date slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-DAX-to-filter-rows-in-table-based-on-a-date-slicer/m-p/3989764#M154705</link>
      <description>&lt;LI-CODE lang="markup"&gt;I'm thinking the way to do would be to use measures.&lt;/LI-CODE&gt;
&lt;P&gt;yes, that is one part of the solution.&amp;nbsp; The other part is that the timeline slicer must be fed from a disconnected table.&amp;nbsp; Then use your measure to sense what is selected there, and to compute the visibility of the rows in your data model.&amp;nbsp; Lastly use that measure as a visual level filter.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 00:50:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-DAX-to-filter-rows-in-table-based-on-a-date-slicer/m-p/3989764#M154705</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-06-13T00:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to use DAX to filter rows in table based on a date slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-DAX-to-filter-rows-in-table-based-on-a-date-slicer/m-p/3990520#M154763</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thanks, I appreciate the response but like I said,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;I'm new to PBI and DAX, so how would I do that exactly.&lt;BR /&gt;&lt;BR /&gt;The timeline slicer is currently fed by a calendar table that is different to the table of data.&amp;nbsp; There's a 1-2-many relationship between the two tables.&lt;BR /&gt;&lt;BR /&gt;How do I implement what you've suggested.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 07:53:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-DAX-to-filter-rows-in-table-based-on-a-date-slicer/m-p/3990520#M154763</guid>
      <dc:creator>MrHajiCoolBreez</dc:creator>
      <dc:date>2024-06-13T07:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to use DAX to filter rows in table based on a date slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-DAX-to-filter-rows-in-table-based-on-a-date-slicer/m-p/3991210#M154810</link>
      <description>&lt;P&gt;Cut the relationship, or add a disconnected clone of the calendar table.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 13:34:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-DAX-to-filter-rows-in-table-based-on-a-date-slicer/m-p/3991210#M154810</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-06-13T13:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to use DAX to filter rows in table based on a date slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-DAX-to-filter-rows-in-table-based-on-a-date-slicer/m-p/3991232#M154812</link>
      <description>&lt;P&gt;I understand that but how do I implent the second part of this?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"Then use your measure to sense what is selected there, and to compute the visibility of the rows in your data model."&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 13:42:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-DAX-to-filter-rows-in-table-based-on-a-date-slicer/m-p/3991232#M154812</guid>
      <dc:creator>MrHajiCoolBreez</dc:creator>
      <dc:date>2024-06-13T13:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to use DAX to filter rows in table based on a date slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-DAX-to-filter-rows-in-table-based-on-a-date-slicer/m-p/3991251#M154814</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>Thu, 13 Jun 2024 13:47:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-DAX-to-filter-rows-in-table-based-on-a-date-slicer/m-p/3991251#M154814</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-06-13T13:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use DAX to filter rows in table based on a date slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-DAX-to-filter-rows-in-table-based-on-a-date-slicer/m-p/3991262#M154815</link>
      <description>&lt;P&gt;I've provided DDL at the bottom of my question and the expected results in the bullet points below the screenshot in the question.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 13:50:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-DAX-to-filter-rows-in-table-based-on-a-date-slicer/m-p/3991262#M154815</guid>
      <dc:creator>MrHajiCoolBreez</dc:creator>
      <dc:date>2024-06-13T13:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to use DAX to filter rows in table based on a date slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-DAX-to-filter-rows-in-table-based-on-a-date-slicer/m-p/3991370#M154820</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 14:28:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-DAX-to-filter-rows-in-table-based-on-a-date-slicer/m-p/3991370#M154820</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-06-13T14:28:16Z</dc:date>
    </item>
  </channel>
</rss>

