<?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: Active relationship causing count to be wrong in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2544936#M71802</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which date column are you using in your visual?&lt;/P&gt;</description>
    <pubDate>Sat, 28 May 2022 02:07:53 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2022-05-28T02:07:53Z</dc:date>
    <item>
      <title>Active relationship causing count to be wrong</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2543765#M71730</link>
      <description>&lt;DIV&gt;&lt;SPAN&gt;I'm trying to count number of empty propertys by counting the previous tenancy numbers that exist in the empty property table.&amp;nbsp;"hraptvpd"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;It's worth mentioning that&amp;nbsp;hraptvpd is directly quering the database.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;hraptvpd has an active relationship of next_tency_st to DateQuery[Date]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;It also has an inactive relationship of prev_tency_end to&amp;nbsp;DateQuery[Date]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The only way I know it was empty (it could be empty multiple times) is the gap in dates between the previous tenancy end (hraptvpd[prev_tency_end]) and next tenancy start (hraptvpd[&lt;SPAN&gt;next_tency_st&lt;/SPAN&gt;])&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have tried:&lt;/DIV&gt;&lt;DIV&gt;Which gives the error:&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Count of property empty = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;USERELATIONSHIP&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;hraptvpd[prev_tency_end]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;DateQuery[Date]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;COUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;hraptvpd[prev_tency]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DATESBETWEEN&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DateQuery[Date]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;hraptvpd[prev_tency_end]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;hraptvpd[next_tency_st]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;------------------------------------------------------&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Count of property ID = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;COUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;hraptvpd[prev_tency]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;hraptvpd&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;hraptvpd[prev_tency_end]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt; &lt;/SPAN&gt;&lt;SPAN&gt;DateQuery[End of Month]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp; &lt;/SPAN&gt;&lt;SPAN&gt;hraptvpd[next_tency_st]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;DateQuery[End of Month]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;The second solution above can only count the number of tenancies that started on the end of month:&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;If anyone can help I'd be enternally grateful.&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 27 May 2022 11:58:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2543765#M71730</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-27T11:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Active relationship causing count to be wrong</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2543809#M71735</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;Maybe:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Count of property empty =
CALCULATE( COUNT(hraptvpd[prev_tency]),
USERELATIONSHIP(hraptvpd[prev_tency_end], DateQuery[Date]),
DATESBETWEEN(DateQuery[Date], hraptvpd[prev_tency_end], hraptvpd[next_tency_st])
)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 27 May 2022 12:14:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2543809#M71735</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2022-05-27T12:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Active relationship causing count to be wrong</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2543843#M71739</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I get this error:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;to give an example of the data:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 12:24:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2543843#M71739</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-27T12:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: Active relationship causing count to be wrong</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2544144#M71751</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Dan&lt;/P&gt;&lt;P&gt;kindly share a screenshot of the data model tab&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 14:36:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2544144#M71751</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-27T14:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: Active relationship causing count to be wrong</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2544208#M71757</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please ignore the mess. You wouldn't want to see the rest.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. is hraptvpd[next_tency_st] to DateQuery[Date] (this is active)&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;is hraptvpd[prev_tency_end] to DateQuery[Date] (this is inactive)&lt;/P&gt;&lt;P&gt;3.&amp;nbsp;is hraptvpd[act_end_dt] to DateQuery[Date] (this is inactive)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;</description>
      <pubDate>Fri, 27 May 2022 15:11:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2544208#M71757</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-27T15:11:32Z</dc:date>
    </item>
    <item>
      <title>Re: Active relationship causing count to be wrong</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2544322#M71760</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;first you have to deactivate the active relationship. Or otherwise you need add REMOVEFILTERS (&amp;nbsp;&lt;SPAN&gt;DateQuery ) with CALCULATE to the following code which considers the property empty only if it is epmty in the whole period.&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Count of property empty =
COUNTROWS (
    FILTER (
        hraptvpd,
        hraptvpd[prev_tency_end] &amp;lt; MIN ( DateQuery[Date] )
            &amp;amp;&amp;amp; hraptvpd[next_tency_st] &amp;gt; MAX ( DateQuery[Date] )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 16:17:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2544322#M71760</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-27T16:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Active relationship causing count to be wrong</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2544809#M71793</link>
      <description>&lt;P&gt;Even if I remove the relationships it doesn't count anything &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 22:10:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2544809#M71793</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-27T22:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Active relationship causing count to be wrong</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2544936#M71802</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which date column are you using in your visual?&lt;/P&gt;</description>
      <pubDate>Sat, 28 May 2022 02:07:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2544936#M71802</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-28T02:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Active relationship causing count to be wrong</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2545543#M71870</link>
      <description>&lt;P&gt;Month-Year in the DateQuery table. I have tried with a blank table and it doesn't show anything&lt;/P&gt;</description>
      <pubDate>Sat, 28 May 2022 20:27:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2545543#M71870</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-28T20:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: Active relationship causing count to be wrong</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2545561#M71875</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought you want to slice by this column. I don't understand the meaning of using a blank table. However, please try the follow which I guess should work even in a card visual.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Count of property empty =
SUMX (
    VALUES ( DateQuery[Month-Year] ),
    CALCULATE (
        COUNTROWS (
            FILTER (
                hraptvpd,
                hraptvpd[prev_tency_end] &amp;lt; MIN ( DateQuery[Date] )
                    &amp;amp;&amp;amp; hraptvpd[next_tency_st] &amp;gt; MAX ( DateQuery[Date] )
            )
        )
    )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 28 May 2022 20:41:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2545561#M71875</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-28T20:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: Active relationship causing count to be wrong</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2545595#M71880</link>
      <description>&lt;P&gt;Still nothing &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 May 2022 21:55:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2545595#M71880</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-28T21:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: Active relationship causing count to be wrong</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2545770#M71886</link>
      <description>&lt;P&gt;Good Morning&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I need to connect with you possible&amp;nbsp;on Monday&lt;/P&gt;</description>
      <pubDate>Sun, 29 May 2022 03:23:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2545770#M71886</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-29T03:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: Active relationship causing count to be wrong</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2548370#M72047</link>
      <description>&lt;P&gt;How would we do this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2022 18:47:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Active-relationship-causing-count-to-be-wrong/m-p/2548370#M72047</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-30T18:47:45Z</dc:date>
    </item>
  </channel>
</rss>

