<?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: Selection between two dates in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/921388#M9101</link>
    <description>&lt;P&gt;Thanks, I will try to update my ssas in due time.&lt;BR /&gt;&lt;BR /&gt;For now I made the following measure, which seems to work:&lt;BR /&gt;ClientsonDate:=IF ( HASONEVALUE ( 'Date'[BK_Date] );&lt;BR /&gt;CALCULATE ( DISTINCTCOUNT ( 'Fct'[clients] );&lt;BR /&gt;FILTER ( 'Fct'; 'Fct'[Startdate] &amp;lt;= MIN ( 'Date'[BK_Date] ) &amp;amp;&amp;amp; 'Fct'[EndDate] &amp;gt;= MAX ( 'Date'[BK_Date] )))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this measure also works fine without the IF (HASONEVALUE() part. So I was overthinking the whole thing and just needed to deactivate the connection between the Date and Fact tables.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Feb 2020 15:43:17 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-02-04T15:43:17Z</dc:date>
    <item>
      <title>Selection between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/916433#M8897</link>
      <description>&lt;P&gt;Hi there,&lt;BR /&gt;&lt;BR /&gt;I have a Fact table with client mutations, with eacht mutation having a StartDate and an EndDate. There is a separate Date dimension table.&amp;nbsp;I am working with an SSAS Cube, Visual studio and a live connected Db.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;In the report, I want to be able to show the number of clients on a selected date.&lt;BR /&gt;So I first created a measure that gives me a value when the selected date is in between the StartDate and EndDate:&lt;BR /&gt;&lt;BR /&gt;CheckDate:= VAR SELECTEDDATE = SELECTEDVALUE(Dim_REF_Date[BK_Date])&lt;BR /&gt;RETURN&lt;BR /&gt;IF(SELECTEDDATE &amp;gt; MIN(FCT_JGZ[StartDate]) &amp;amp;&amp;amp; SELECTEDDATE &amp;lt; MAX(FCT_JGZ[EndDate]); 1; 0)&lt;BR /&gt;&lt;BR /&gt;Then I created a measure to count the number of clients:&lt;BR /&gt;ClientsOnDate:= CALCULATE(DISTINCTCOUNT('Fct_JGZ'[ClientNumber]); 'Fct_JGZ'; [CheckDate]=1)&lt;BR /&gt;&lt;BR /&gt;This gave an error: &lt;SPAN&gt;&amp;nbsp;'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed.&lt;/SPAN&gt;&lt;BR /&gt;So I changed this to:&lt;BR /&gt;ClientsOnDate:= CALCULATE(DISTINCTCOUNT('Fct_JGZ'[ClientNumber]); FILTER('Fct_JGZ'; [CheckDate]=1))&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Although this formula does not show an error.. in the report, this measure doesn't show anything..?&lt;BR /&gt;Am I doing something wrong?&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 12:18:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/916433#M8897</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-01-30T12:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: Selection between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/919357#M9022</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;try this for your measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ClientsOnDate :=
VAR SELECTEDDATE =
    SELECTEDVALUE ( Dim_REF_Date[BK_Date] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'Fct_JGZ'[ClientNumber] );
        FILTER (
            'Fct_JGZ';
            SELECTEDDATE &amp;gt; FCT_JGZ[StartDate]
                &amp;amp;&amp;amp; SELECTEDDATE &amp;lt; FCT_JGZ[EndDate]
        )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;BR /&gt;Sturla&lt;BR /&gt;&lt;BR /&gt;If this post helps, then please consider Accepting it as the solution. Kudos are nice too.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 08:56:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/919357#M9022</guid>
      <dc:creator>sturlaws</dc:creator>
      <dc:date>2020-02-03T08:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: Selection between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/919462#M9027</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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ClientsOnDate:= CALCULATE(DISTINCTCOUNT('Fct_JGZ'[ClientNumber]),filter( 'Dim_REF_Date',Dim_REF_Date[BK_Date]&amp;gt;MIN(FCT_JGZ[StartDate]) &amp;amp;&amp;amp; Dim_REF_Date[BK_Date]&amp;lt; MAX(FCT_JGZ[EndDate]))\&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards,&lt;BR /&gt;Pravin Wattamwar&lt;BR /&gt;&lt;A href="http://www.linkedin.com/in/pravin-p-wattamwar" target="_blank"&gt;www.linkedin.com/in/pravin-p-wattamwar&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;If I resolve your problem Mark it as a solution and give kudos.&lt;/P&gt;&lt;P&gt;check my blog here&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Connecting-to-a-Tabular-Model-Using-Power-BI/ba-p/913784" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Connecting-to-a-Tabular-Model-Using-Power-BI/ba-p/913784&lt;/A&gt;&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;&lt;P&gt;&amp;nbsp;&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 10:11:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/919462#M9027</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-03T10:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: Selection between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/919702#M9035</link>
      <description>&lt;P&gt;Hi Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you for your reply. The formula 'sort of' works, but it only shows the clients who have the exact BK_date that I select.&lt;BR /&gt;I then realized I have another problem:&lt;BR /&gt;&lt;BR /&gt;The Date Dimension is connected to the Fact StartDate column (via DateID columns).&lt;BR /&gt;So when I use BK_Date in a filter, it logically filters the Fact for only those StartDate's.&lt;BR /&gt;I tried to set the connection to 'unactive', but this results in no data showing at all.&lt;BR /&gt;I'm not sure how to solve this.&lt;BR /&gt;&lt;BR /&gt;In addition, when I make a copy of my model in Power Bi Desktop (instead of in SSAS), the formula does show the correct result, as long as I set the connection to 'unactive'. Any idea why it does work here and not in my tabular model?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;M.Lameijer&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 13:51:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/919702#M9035</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-03T13:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: Selection between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/919711#M9036</link>
      <description>&lt;P&gt;In SSAS Model only disconnect date dimension with your fact.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume your fact table have start date and end date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now come to power Bi and use date dimension is slicer as after/before/Between slicer as per requirement.&lt;/P&gt;&lt;P&gt;I am giving example for after slicer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Calculate(count(Fact[column]),filter(fact,fact[star_date] &amp;lt; min(dim[Date]) &amp;amp;&amp;amp;&amp;nbsp;fact[end_date] &amp;gt; min(dim[Date]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just check those less than greater than conditions as per your requirement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards,&lt;BR /&gt;Pravin Wattamwar&lt;BR /&gt;&lt;A href="http://www.linkedin.com/in/pravin-p-wattamwar" target="_blank" rel="noopener"&gt;www.linkedin.com/in/pravin-p-wattamwar&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;If I resolve your problem Mark it as a solution and give kudos.&lt;/P&gt;&lt;P&gt;check my blog here&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Connecting-to-a-Tabular-Model-Using-Power-BI/ba-p/913784" target="_blank" rel="noopener"&gt;https://community.powerbi.com/t5/Community-Blog/Connecting-to-a-Tabular-Model-Using-Power-BI/ba-p/913784&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 14:03:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/919711#M9036</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-03T14:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Selection between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/919777#M9038</link>
      <description>&lt;P&gt;When I disconnect the fact and Date dimension the BK_date filter does nothing, whether I select a single date or a range.&lt;BR /&gt;Now the two formulas show all clients that exist in the database.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again, it does work in a local Power BI model, but not in my SSAS model.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 14:51:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/919777#M9038</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-03T14:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: Selection between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/919792#M9040</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="88633" data-lia-user-login="sturlaws" class="lia-mention lia-mention-user"&gt;sturlaws&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the formula does not seem to work. In my report, it just says 'can't display the visual'.&lt;BR /&gt;It can't seem to resolve the BK_date as Selectedvalue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 15:05:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/919792#M9040</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-03T15:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: Selection between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/920050#M9046</link>
      <description>For table filter with disconnected slicer you need to do is&lt;BR /&gt;&lt;BR /&gt;If(max(table[startdate])&amp;gt;min(dim[date]) &amp;amp;&amp;amp; max(table[enddate])&amp;lt;min(dim[date]),1,0)&lt;BR /&gt;&lt;BR /&gt;Note: i assumed after date slicer here.&lt;BR /&gt;&lt;BR /&gt;And set this measure to 1 in table level filter.&lt;BR /&gt;&lt;BR /&gt;Now this one will show only data which is with the above date condition.&lt;BR /&gt;&lt;BR /&gt;Still if you have any doubt feel free to ask.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Pravin wattamwar</description>
      <pubDate>Mon, 03 Feb 2020 17:39:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/920050#M9046</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-03T17:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Selection between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/920207#M9061</link>
      <description>&lt;P&gt;Here is an example of how it works: &lt;A href="https://www.dropbox.com/s/fscus7qphtp78hi/Selection%20between%20two%20dates.pbix?dl=0" target="_self"&gt;pbix&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 19:50:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/920207#M9061</guid>
      <dc:creator>sturlaws</dc:creator>
      <dc:date>2020-02-03T19:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: Selection between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/921060#M9081</link>
      <description>&lt;P&gt;I am sorry, but I don't understand.&lt;/P&gt;&lt;P&gt;First, what is a table level filter?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I created the IF-statement as a measure, but it cant be added to a slicer or used as a visual level filter.&lt;BR /&gt;&lt;BR /&gt;Going back to my measure that uses selectedvalue, the error it gives is:&lt;BR /&gt;Failed to resolve name 'SELECTEDVALUE'. It is not a valid table, variable or function name.&lt;BR /&gt;&lt;BR /&gt;Does this give you an idea of why it is not working? (I am working in January 2019 version of PBI for Reporting Server.)&lt;BR /&gt;Is selectedvalue even supported in live connection/direct query?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 10:55:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/921060#M9081</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-04T10:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Selection between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/921063#M9082</link>
      <description>&lt;P&gt;Thanks a lot, I had also tried to create my model in pbi deskstop. But again, the formula works in PBI desktop, but not in my live connected SSAS model.&lt;BR /&gt;&lt;BR /&gt;Is SELECTEDVALUE supported for live connections? And if not, are there other ways to do this?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 10:57:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/921063#M9082</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-04T10:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: Selection between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/921077#M9083</link>
      <description>&lt;P&gt;sorry tablel level filter means visual level filter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;follow the steps which i have suggested.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards,&lt;BR /&gt;Pravin Wattamwar&lt;BR /&gt;&lt;A href="http://www.linkedin.com/in/pravin-p-wattamwar" target="_blank"&gt;www.linkedin.com/in/pravin-p-wattamwar&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;If I resolve your problem Mark it as a solution and give kudos.&lt;/P&gt;&lt;P&gt;check my blog here&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Connecting-to-a-Tabular-Model-Using-Power-BI/ba-p/913784" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Connecting-to-a-Tabular-Model-Using-Power-BI/ba-p/913784&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 11:01:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/921077#M9083</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-04T11:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: Selection between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/921078#M9084</link>
      <description>&lt;P&gt;Which version of SSAS are you running?&lt;BR /&gt;&lt;BR /&gt;According to this:&amp;nbsp;&lt;A href="https://dax.guide/selectedvalue/" target="_blank"&gt;https://dax.guide/selectedvalue/&lt;/A&gt;&amp;nbsp;selectedvalue is supported in SSAS 2017 and 2019&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 11:02:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/921078#M9084</guid>
      <dc:creator>sturlaws</dc:creator>
      <dc:date>2020-02-04T11:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Selection between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/921120#M9087</link>
      <description>&lt;P&gt;I am using VS 2017 - Version 15.8.7&lt;BR /&gt;I am also using Power BI for reporting service, version Jan 2019.&lt;BR /&gt;I am using SSMS 13.0.5101.9&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 11:40:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/921120#M9087</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-04T11:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: Selection between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/921143#M9090</link>
      <description>&lt;P&gt;By VS 2017 it seems like you are refering to Visual studio, is that correct? Which version of VS you have should not matter, but you need to check the version of your SSAS installation:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;to check the SSAS version go to SSMS -- connect to SSAS instance --&amp;gt; reports -&amp;gt; standard reports --&amp;gt; General and there would be the version for you&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But perhaps more important , it does not work in direct query:&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/SELECTEDVALUE-not-a-valid-function/td-p/270639" target="_blank"&gt;https://community.powerbi.com/t5/Desktop/SELECTEDVALUE-not-a-valid-function/td-p/270639&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;you can rewrite by using the hasonevalue-function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 11:59:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/921143#M9090</guid>
      <dc:creator>sturlaws</dc:creator>
      <dc:date>2020-02-04T11:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Selection between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/921388#M9101</link>
      <description>&lt;P&gt;Thanks, I will try to update my ssas in due time.&lt;BR /&gt;&lt;BR /&gt;For now I made the following measure, which seems to work:&lt;BR /&gt;ClientsonDate:=IF ( HASONEVALUE ( 'Date'[BK_Date] );&lt;BR /&gt;CALCULATE ( DISTINCTCOUNT ( 'Fct'[clients] );&lt;BR /&gt;FILTER ( 'Fct'; 'Fct'[Startdate] &amp;lt;= MIN ( 'Date'[BK_Date] ) &amp;amp;&amp;amp; 'Fct'[EndDate] &amp;gt;= MAX ( 'Date'[BK_Date] )))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this measure also works fine without the IF (HASONEVALUE() part. So I was overthinking the whole thing and just needed to deactivate the connection between the Date and Fact tables.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 15:43:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Selection-between-two-dates/m-p/921388#M9101</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-04T15:43:17Z</dc:date>
    </item>
  </channel>
</rss>

