<?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: Records in table with at least one day in selected period by slicer in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1777986#M37293</link>
    <description>&lt;P&gt;I have created a separate date table using the DAX expression&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Vanaf Datum = CALENDAR(MIN(Contract[Vanaf Datum]),MAX(Contract[Tot Datum])), so the date column ranges from the date the first contract was valid to the date the last contract ends. This table has a one-to-many relation with the Vanaf Datum column in the contracts table and I use this date column in my slicer.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Sat, 10 Apr 2021 09:36:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-04-10T09:36:05Z</dc:date>
    <item>
      <title>Records in table with at least one day in selected period by slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1776418#M37236</link>
      <description>&lt;P&gt;I have an SQL table with contracts and the valid from (Vanaf Datum) and valid to dates of these contracts. I want to create a table in Power BI in which all records are shown that have at least one day in the selected period by my slicer. Currently, I have the following dashboard:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Now, this table only shows the records which have a Vanaf Datum in the selected slicer period from 1-3-2021 to 31-3-2021. However, I want my Power BI table to include all records (in red) that have at least one day in the selected filter period (in black)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;How can I do this in Power BI?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 09:17:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1776418#M37236</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-04-09T09:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: Records in table with at least one day in selected period by slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1776606#M37241</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , Ffor this you need an independent date table and then try a measure like &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;measure =&lt;BR /&gt;var _max = maxx(ALLSELECTED('Date'),'Date'[Date])&lt;BR /&gt;var _min = minx(ALLSELECTED('Date'),'Date'[Date])&lt;BR /&gt;return &lt;BR /&gt;calculate(countrows(Table), filter('Table', ('Table'[Vanaf Datum] &amp;lt;=_max 'Table'[Vanaf Datum] &amp;gt;=Min ) ||('Table'[To Datum2] &amp;lt;=_max 'Table'[To Datum2] &amp;gt;=Min ) ))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 10:53:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1776606#M37241</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-04-09T10:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Records in table with at least one day in selected period by slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1776967#M37263</link>
      <description>&lt;P&gt;Can you elaborate on how this measure will help in creating the desired table as I explained above?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 13:41:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1776967#M37263</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-04-09T13:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Records in table with at least one day in selected period by slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1777736#M37286</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does your model have a proper date table or do you take your dates straight from the fact table?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 21:19:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1777736#M37286</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-04-09T21:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: Records in table with at least one day in selected period by slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1777986#M37293</link>
      <description>&lt;P&gt;I have created a separate date table using the DAX expression&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Vanaf Datum = CALENDAR(MIN(Contract[Vanaf Datum]),MAX(Contract[Tot Datum])), so the date column ranges from the date the first contract was valid to the date the last contract ends. This table has a one-to-many relation with the Vanaf Datum column in the contracts table and I use this date column in my slicer.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 10 Apr 2021 09:36:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1777986#M37293</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-04-10T09:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: Records in table with at least one day in selected period by slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1778232#M37304</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please have a look at this. It's an excerpt from the documentation of one of the time-intel functions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In order to use any time intelligence calculation, you need a well-formed date table. The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;I&gt;Date&lt;/I&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;table must satisfy the following requirements:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;All dates need to be present for the years required. The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;I&gt;Date&lt;/I&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;table must always start on January 1 and end on December 31, including all the days in this range. If the report only references fiscal years, then the date table must include all the dates from the first to the last day of a fiscal year. For example, if the fiscal year 2008 starts on July 1, 2007, then the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;I&gt;Date&lt;/I&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;table must include all the days from July 1, 2007 to June 30, 2008.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;There needs to be a column with a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;I&gt;DateTime&lt;/I&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;or&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;I&gt;Date&lt;/I&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;data type containing unique values. This column is usually called&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;I&gt;Date&lt;/I&gt;. Even though the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;I&gt;Date&lt;/I&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;column is often used to define relationships with other tables, this is not required. Still, the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;I&gt;Date&lt;/I&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;column must contain unique values and should be referenced by the Mark as Date Table feature. In case the column also contains a time part, no time should be used – for example, the time should always be 12:00 am.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;I&gt;Date&lt;/I&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;table must be marked as a date table in the model, in case the relationship between the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;I&gt;Date&lt;/I&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;table and any other table is not based on the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;I&gt;Date&lt;/I&gt;.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't think your table conforms to this.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Apr 2021 22:01:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1778232#M37304</guid>
      <dc:creator>daxer-almighty</dc:creator>
      <dc:date>2021-04-10T22:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: Records in table with at least one day in selected period by slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1778233#M37305</link>
      <description>&lt;P&gt;Secondly, you have to disconnect the Date table from the fact table. Only then will you be able to calculate what you want. All you need is a measure that will return 1 for each row in the table in your first post that should be included and 0 for each that should be excluded. Then you filter the visual using this measure: show a row when the measure = 1. I'll show you the measure in a moment...&lt;/P&gt;</description>
      <pubDate>Sat, 10 Apr 2021 22:10:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1778233#M37305</guid>
      <dc:creator>daxer-almighty</dc:creator>
      <dc:date>2021-04-10T22:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: Records in table with at least one day in selected period by slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1778236#M37306</link>
      <description>&lt;P&gt;Here's the measure to filter the rows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// If you have a Dates table
// that is DISCONNECTED from
// the fact table...

[Show Contract] =
IF( ISINSCOPE( FT[ContractID] ),
    var ContractStartDate =
        SELECTEDVALUE( FT[Vanaf Datum] )
    var ContractEndDate =
        SELECTEDVALUE( FT[Tot Datum2] )
    var StartDate = MIN( Dates[Vanaf Datum] )
    var EndDate = MAX( Dates[Vanaf Datum] )
    return
        1 * NOT(
            ContractEndDate &amp;lt; StartDate
            ||
            EndDate &amp;lt; ContractStartDate
        )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 10 Apr 2021 22:16:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1778236#M37306</guid>
      <dc:creator>daxer-almighty</dc:creator>
      <dc:date>2021-04-10T22:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: Records in table with at least one day in selected period by slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1786143#M37543</link>
      <description>&lt;P&gt;Great! Exactly what I needed. Thank you very much.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 07:12:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/1786143#M37543</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-04-15T07:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Records in table with at least one day in selected period by slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/2303736#M56982</link>
      <description>&lt;P&gt;This is marked as a Solution, but I think it is just a partial solution. How would you go about implementing this measure into a slicer? If I try doing that, Power BI won't allow it. It also does not like the "NOT" command, forcing me to remove it and reverse the greater/less than signs (not even sure that will work, but i'm hoping it will).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the next step to this solution, so that I can select a period (month) in a slicer and it knows which records to include? Amit's proposal below also doesn't work - PBI doesn't recognize the tables in the CALCULATE command when I try to implement.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jan 2022 20:54:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Records-in-table-with-at-least-one-day-in-selected-period-by/m-p/2303736#M56982</guid>
      <dc:creator>Radek_Z</dc:creator>
      <dc:date>2022-01-26T20:54:19Z</dc:date>
    </item>
  </channel>
</rss>

