<?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 DISTINCCOUNT with FILTERs based on unrelated calendartable in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DISTINCCOUNT-with-FILTERs-based-on-unrelated-calendartable/m-p/3050523#M105055</link>
    <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;as DAX beginner I'm currently struggling with my code and I would much appreciate, if somebody could help me to find the right way.&lt;/P&gt;&lt;P&gt;I have two unrelated tables:&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;DIM_calendar&amp;nbsp; with a date-colum&lt;/LI&gt;&lt;LI&gt;FACT_Projects with a start-column and an end-column&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;All the date related columnes are formatted as date.&lt;/P&gt;&lt;P&gt;In my report I have a Time related slicer for different visuals, where I'm e. g. showing montly results etc.&lt;/P&gt;&lt;P&gt;No I would like to show in another visual only the number of ongoing projects at the end of the selected time period (last month), means all projects which were ongoing at the beginning of the selected period by slicer, but ending earlier than the last month should not be considered. As both tables are unrelated (as I cannot create relation to&amp;nbsp;tart-column and end-column)&amp;nbsp;I'm using the TREATAS-Function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to create the following measure:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;Ongoing_Projects =&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt; &lt;SPAN&gt;(&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt; &lt;SPAN&gt;FACT_Project[Project_ID]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FACT_Project[Project_end]&lt;/SPAN&gt; &amp;gt;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;TREATAS&lt;/SPAN&gt; &lt;SPAN&gt;(&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;VALUES&lt;/SPAN&gt; &lt;SPAN&gt;(&lt;/SPAN&gt; &lt;SPAN&gt;DIM_calendar[Date]&lt;/SPAN&gt; &lt;SPAN&gt;)&lt;/SPAN&gt;,&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;FACT_Project[end]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt; &lt;SPAN&gt;FACT_Project[start]&lt;/SPAN&gt; &amp;lt;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;TREATAS&lt;/SPAN&gt; &lt;SPAN&gt;(&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;VALUES&lt;/SPAN&gt; &lt;SPAN&gt;(&lt;/SPAN&gt; &lt;SPAN&gt;DIM_calender[Date]&lt;/SPAN&gt; &lt;SPAN&gt;)&lt;/SPAN&gt;,&amp;nbsp; &lt;SPAN&gt;FACT_Project&lt;/SPAN&gt;&lt;SPAN&gt;[von]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which don't work&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":sad_but_relieved_face:"&gt;😥&lt;/span&gt;&amp;nbsp;I think the reason is, that I didn't adress the start and the end of the slicer selection correctly, but no idea how to solve this issue.&lt;BR /&gt;Can anybody help me ? Thanks a lot in advance for all efforts&lt;/P&gt;&lt;P&gt;Bärbel&lt;/P&gt;</description>
    <pubDate>Mon, 30 Jan 2023 13:52:20 GMT</pubDate>
    <dc:creator>Baerbel</dc:creator>
    <dc:date>2023-01-30T13:52:20Z</dc:date>
    <item>
      <title>DISTINCCOUNT with FILTERs based on unrelated calendartable</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DISTINCCOUNT-with-FILTERs-based-on-unrelated-calendartable/m-p/3050523#M105055</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;as DAX beginner I'm currently struggling with my code and I would much appreciate, if somebody could help me to find the right way.&lt;/P&gt;&lt;P&gt;I have two unrelated tables:&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;DIM_calendar&amp;nbsp; with a date-colum&lt;/LI&gt;&lt;LI&gt;FACT_Projects with a start-column and an end-column&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;All the date related columnes are formatted as date.&lt;/P&gt;&lt;P&gt;In my report I have a Time related slicer for different visuals, where I'm e. g. showing montly results etc.&lt;/P&gt;&lt;P&gt;No I would like to show in another visual only the number of ongoing projects at the end of the selected time period (last month), means all projects which were ongoing at the beginning of the selected period by slicer, but ending earlier than the last month should not be considered. As both tables are unrelated (as I cannot create relation to&amp;nbsp;tart-column and end-column)&amp;nbsp;I'm using the TREATAS-Function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to create the following measure:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;Ongoing_Projects =&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt; &lt;SPAN&gt;(&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt; &lt;SPAN&gt;FACT_Project[Project_ID]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FACT_Project[Project_end]&lt;/SPAN&gt; &amp;gt;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;TREATAS&lt;/SPAN&gt; &lt;SPAN&gt;(&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;VALUES&lt;/SPAN&gt; &lt;SPAN&gt;(&lt;/SPAN&gt; &lt;SPAN&gt;DIM_calendar[Date]&lt;/SPAN&gt; &lt;SPAN&gt;)&lt;/SPAN&gt;,&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;FACT_Project[end]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt; &lt;SPAN&gt;FACT_Project[start]&lt;/SPAN&gt; &amp;lt;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;TREATAS&lt;/SPAN&gt; &lt;SPAN&gt;(&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;VALUES&lt;/SPAN&gt; &lt;SPAN&gt;(&lt;/SPAN&gt; &lt;SPAN&gt;DIM_calender[Date]&lt;/SPAN&gt; &lt;SPAN&gt;)&lt;/SPAN&gt;,&amp;nbsp; &lt;SPAN&gt;FACT_Project&lt;/SPAN&gt;&lt;SPAN&gt;[von]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which don't work&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":sad_but_relieved_face:"&gt;😥&lt;/span&gt;&amp;nbsp;I think the reason is, that I didn't adress the start and the end of the slicer selection correctly, but no idea how to solve this issue.&lt;BR /&gt;Can anybody help me ? Thanks a lot in advance for all efforts&lt;/P&gt;&lt;P&gt;Bärbel&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 13:52:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DISTINCCOUNT-with-FILTERs-based-on-unrelated-calendartable/m-p/3050523#M105055</guid>
      <dc:creator>Baerbel</dc:creator>
      <dc:date>2023-01-30T13:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: DISTINCCOUNT with FILTERs based on unrelated calendartable</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DISTINCCOUNT-with-FILTERs-based-on-unrelated-calendartable/m-p/3050730#M105070</link>
      <description>&lt;P&gt;Try&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Ongoing projects =
VAR MaxDate =
    MAX ( 'Dim_calendar'[Date] )
VAR Result =
    CALCULATE (
        COUNTROWS ( 'FACT_project' ),
        'FACT_project'[start date] &amp;lt;= MaxDate
            &amp;amp;&amp;amp; (
                ISBLANK ( 'FACT_project'[End date] )
                    || 'FACT_project'[End date] &amp;gt; MaxDate
            )
    )
RETURN
    Result
&lt;/LI-CODE&gt;
&lt;P&gt;This assumes that there is only 1 entry in the fact table for each project. If there might be multiple entries then you can replace the COUNTROWS with&amp;nbsp;&lt;SPAN&gt;DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;FACT_Project[Project_ID]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 15:29:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DISTINCCOUNT-with-FILTERs-based-on-unrelated-calendartable/m-p/3050730#M105070</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-01-30T15:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: DISTINCCOUNT with FILTERs based on unrelated calendartable</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DISTINCCOUNT-with-FILTERs-based-on-unrelated-calendartable/m-p/3051161#M105096</link>
      <description>&lt;P&gt;WoW&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt; you made my day, thanks so much, it works&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In any case you would have another second for me to understand - why it works without a relationship between&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 20:08:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DISTINCCOUNT-with-FILTERs-based-on-unrelated-calendartable/m-p/3051161#M105096</guid>
      <dc:creator>Baerbel</dc:creator>
      <dc:date>2023-01-30T20:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: DISTINCCOUNT with FILTERs based on unrelated calendartable</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DISTINCCOUNT-with-FILTERs-based-on-unrelated-calendartable/m-p/3052155#M105179</link>
      <description>&lt;P&gt;A relationship with the date table would only help to capture events that happened on a specific date, or within a range of specified dates. Here you are wanting to check whether one date was before the given date range and one was after, so a relationship wouldn't help.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 09:13:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DISTINCCOUNT-with-FILTERs-based-on-unrelated-calendartable/m-p/3052155#M105179</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-01-31T09:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: DISTINCCOUNT with FILTERs based on unrelated calendartable</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DISTINCCOUNT-with-FILTERs-based-on-unrelated-calendartable/m-p/3052265#M105185</link>
      <description>&lt;P&gt;Thanks - its a helpfull info for me for similiar issues&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 09:41:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DISTINCCOUNT-with-FILTERs-based-on-unrelated-calendartable/m-p/3052265#M105185</guid>
      <dc:creator>Baerbel</dc:creator>
      <dc:date>2023-01-31T09:41:44Z</dc:date>
    </item>
  </channel>
</rss>

