<?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: Filter rows where SELECTEDYEAR() is in between two columns in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-rows-where-SELECTEDYEAR-is-in-between-two-columns/m-p/3740484#M145847</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks for the fast reply&lt;BR /&gt;&lt;BR /&gt;In fromDate and toDate, as well as date column in date table are of typ&amp;nbsp;&lt;EM&gt;date&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;The relationship between fromDate and date is active&lt;/P&gt;&lt;P&gt;The relationship between toDate and date is inactive&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;These are the once I am using in my relationship.&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I forgot to provide is details on how I extract the YEAR.&amp;nbsp;&lt;/P&gt;&lt;P&gt;fromDate and toDate have two respective calculated columns, called fromYear and toYear.&amp;nbsp;&lt;STRONG&gt;These are the ones I am using in my measure.&lt;/STRONG&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I will make sure to edit that in the original post.&lt;/P&gt;</description>
    <pubDate>Mon, 04 Mar 2024 15:53:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-03-04T15:53:32Z</dc:date>
    <item>
      <title>Filter rows where SELECTEDYEAR() is in between two columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-rows-where-SELECTEDYEAR-is-in-between-two-columns/m-p/3740404#M145844</link>
      <description>&lt;P&gt;Help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a hard time solving this, from a programming perspective, easy task in DAX.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;What I want to solve:&lt;/P&gt;&lt;P&gt;1. User selects a year from a slicer. This year comes from a date table&lt;/P&gt;&lt;P&gt;2. All rows where the selected years are in &lt;STRONG&gt;between FromDate and ToDate should be returned.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;3. From here, I want to DISTINCTCOUNT() an ID and display them in different visuals, using different categories, accross the page.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What I've tried so far:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;M =
CALCULATE(
    DISTINCTCOUNT('datastore X'[ID]),
    FILTER (
        ALL('datastore X'[FromYear], 'datastore X'[ToYear], 'datastore X'[ID]),
        'datastore X'[FromYear] &amp;lt;= [SelectedYear] &amp;amp;&amp;amp;
        'datastore X'[ToYear] &amp;gt;= [SelectedYear]
    )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;Where [SelectedYear] = SELECTEDVALUE('datastore Y'[Year]).&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The problem with this measure is that if the user selects e.g. 2023, this filter on the table will&amp;nbsp;&lt;EM&gt;first&amp;nbsp;be applied before the measure is executed.&lt;BR /&gt;&lt;BR /&gt;Any help is appreciated!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 15:40:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-rows-where-SELECTEDYEAR-is-in-between-two-columns/m-p/3740404#M145844</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-04T15:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: Filter rows where SELECTEDYEAR() is in between two columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-rows-where-SELECTEDYEAR-is-in-between-two-columns/m-p/3740449#M145845</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;BR /&gt;in order to help you with this, I will need to have some more information about how your model is set up.&amp;nbsp;&lt;BR /&gt;Especially on how the date table is linked to your fact table and also what type of data exactly is in the fromDate and toDate columns. Years or dates?&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 15:22:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-rows-where-SELECTEDYEAR-is-in-between-two-columns/m-p/3740449#M145845</guid>
      <dc:creator>timalbers</dc:creator>
      <dc:date>2024-03-04T15:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Filter rows where SELECTEDYEAR() is in between two columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-rows-where-SELECTEDYEAR-is-in-between-two-columns/m-p/3740484#M145847</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks for the fast reply&lt;BR /&gt;&lt;BR /&gt;In fromDate and toDate, as well as date column in date table are of typ&amp;nbsp;&lt;EM&gt;date&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;The relationship between fromDate and date is active&lt;/P&gt;&lt;P&gt;The relationship between toDate and date is inactive&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;These are the once I am using in my relationship.&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I forgot to provide is details on how I extract the YEAR.&amp;nbsp;&lt;/P&gt;&lt;P&gt;fromDate and toDate have two respective calculated columns, called fromYear and toYear.&amp;nbsp;&lt;STRONG&gt;These are the ones I am using in my measure.&lt;/STRONG&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I will make sure to edit that in the original post.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 15:53:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-rows-where-SELECTEDYEAR-is-in-between-two-columns/m-p/3740484#M145847</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-04T15:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Filter rows where SELECTEDYEAR() is in between two columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-rows-where-SELECTEDYEAR-is-in-between-two-columns/m-p/3740533#M145852</link>
      <description>&lt;P&gt;Ok, if you are only comparing years, and not whole dates, then something like this probably would already work:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;M =
    VAR min_year =
        MIN( date_table[Year] )
    VAR max_year =
        MAX( date_table[Year] )
    RETURN
        CALCULATE(
            DISTINCTCOUNT( 'datastore X'[ID] ),
            'datastore X'[FromYear] &amp;lt;= min_date
                &amp;amp;&amp;amp; 'datastore X'[ToYear] &amp;gt;= max_date
        )&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 04 Mar 2024 16:12:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-rows-where-SELECTEDYEAR-is-in-between-two-columns/m-p/3740533#M145852</guid>
      <dc:creator>timalbers</dc:creator>
      <dc:date>2024-03-04T16:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Filter rows where SELECTEDYEAR() is in between two columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-rows-where-SELECTEDYEAR-is-in-between-two-columns/m-p/3740580#M145857</link>
      <description>&lt;P&gt;I appreciate your help and I think this is a good start, however records that have&lt;BR /&gt;FromYear &amp;lt; Selected year &amp;gt; ToYear&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, e.g., if selected year is 2023, records that have&lt;BR /&gt;FromYear: 2018&lt;BR /&gt;ToYear: 2019&lt;BR /&gt;&lt;BR /&gt;are still included in the resulting table visualisation.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 16:32:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-rows-where-SELECTEDYEAR-is-in-between-two-columns/m-p/3740580#M145857</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-04T16:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: Filter rows where SELECTEDYEAR() is in between two columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-rows-where-SELECTEDYEAR-is-in-between-two-columns/m-p/3754196#M146466</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try to modify your formula with reference to the following:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;M_ = 
CALCULATE(
    DISTINCTCOUNT('datastore X'[ID]),
    FILTER(
        'datastore X',
        'datastore X'[fromYear] &amp;lt;= [SelectedYear] &amp;amp;&amp;amp;
        'datastore X'[toYear] &amp;gt;= [SelectedYear]
    )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Adamk Kong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 07:08:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-rows-where-SELECTEDYEAR-is-in-between-two-columns/m-p/3754196#M146466</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-11T07:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: Filter rows where SELECTEDYEAR() is in between two columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-rows-where-SELECTEDYEAR-is-in-between-two-columns/m-p/3754631#M146484</link>
      <description>&lt;P&gt;Hi Adam,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;THank you for your response, I appreciate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your solution is almost correct, however in your example with the provided measure M_, the person with ID 3 will not show up in the table if the selected year is 2024. In my case, I need that to happen as the ID 3 person was active 2024 given its to and from date (2023 and 2025).&lt;BR /&gt;&lt;BR /&gt;Do you have any suggestion on how to fix that?&lt;BR /&gt;&lt;BR /&gt;Best,&lt;/P&gt;&lt;P&gt;Aksel&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 09:37:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-rows-where-SELECTEDYEAR-is-in-between-two-columns/m-p/3754631#M146484</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-11T09:37:00Z</dc:date>
    </item>
  </channel>
</rss>

