<?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 Counting records based on two dates, second count must exclude records from the first in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-records-based-on-two-dates-second-count-must-exclude/m-p/4363708#M173243</link>
    <description>&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables, a date dimension and a fact.&amp;nbsp; The fact table has two date columns, the date a record was added and a date if/when it was edited.&amp;nbsp; What I need to accomplish is generating a count for the number of records added and number of records edited in a date range.&amp;nbsp; I can accomplish this with two relationships between the two tables and using&amp;nbsp;&lt;SPAN&gt;USERELATIONSHIP() in the count.&amp;nbsp; The trick is that if a record has both the add and edit date in the range, it should only be included in the add count. This is where it falls apart on me; I can't determine how I can get the edit count to exclude records in the add count.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any advice is welcome, TIA.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jan 2025 17:10:55 GMT</pubDate>
    <dc:creator>jbobeck</dc:creator>
    <dc:date>2025-01-14T17:10:55Z</dc:date>
    <item>
      <title>Counting records based on two dates, second count must exclude records from the first</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-records-based-on-two-dates-second-count-must-exclude/m-p/4363708#M173243</link>
      <description>&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables, a date dimension and a fact.&amp;nbsp; The fact table has two date columns, the date a record was added and a date if/when it was edited.&amp;nbsp; What I need to accomplish is generating a count for the number of records added and number of records edited in a date range.&amp;nbsp; I can accomplish this with two relationships between the two tables and using&amp;nbsp;&lt;SPAN&gt;USERELATIONSHIP() in the count.&amp;nbsp; The trick is that if a record has both the add and edit date in the range, it should only be included in the add count. This is where it falls apart on me; I can't determine how I can get the edit count to exclude records in the add count.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any advice is welcome, TIA.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 17:10:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-records-based-on-two-dates-second-count-must-exclude/m-p/4363708#M173243</guid>
      <dc:creator>jbobeck</dc:creator>
      <dc:date>2025-01-14T17:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: Counting records based on two dates, second count must exclude records from the first</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-records-based-on-two-dates-second-count-must-exclude/m-p/4363969#M173252</link>
      <description>&lt;P&gt;You can use EXCEPT for that.&amp;nbsp;Please provide sample data that covers your issue or question &lt;STRONG&gt;completely&lt;/STRONG&gt;, in a &lt;STRONG&gt;usable&lt;/STRONG&gt; format (not as a screenshot).&lt;BR /&gt;Do not include sensitive information. Do not include anything that is unrelated to the issue or question. &lt;BR /&gt;Please show the expected outcome based on the sample data you provided. &lt;BR /&gt;&lt;BR /&gt;Need help uploading data? &lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt; &lt;BR /&gt;Want faster answers? &lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 21:48:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-records-based-on-two-dates-second-count-must-exclude/m-p/4363969#M173252</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2025-01-14T21:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: Counting records based on two dates, second count must exclude records from the first</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-records-based-on-two-dates-second-count-must-exclude/m-p/4364326#M173260</link>
      <description>&lt;P&gt;Hey , use this Approach&lt;BR /&gt;&lt;BR /&gt;Edited Count =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;COUNTROWS(FactTable),&lt;BR /&gt;USERELATIONSHIP(DateTable[Date], FactTable[EditedDate]),&lt;BR /&gt;NOT(&lt;BR /&gt;CONTAINS(&lt;BR /&gt;VALUES(FactTable[RecordID]),&lt;BR /&gt;FactTable[RecordID],&lt;BR /&gt;CALCULATETABLE(&lt;BR /&gt;VALUES(FactTable[RecordID]),&lt;BR /&gt;USERELATIONSHIP(DateTable[Date], FactTable[AddedDate])&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 04:46:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-records-based-on-two-dates-second-count-must-exclude/m-p/4364326#M173260</guid>
      <dc:creator>govind_021</dc:creator>
      <dc:date>2025-01-15T04:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: Counting records based on two dates, second count must exclude records from the first</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-records-based-on-two-dates-second-count-must-exclude/m-p/4365453#M173326</link>
      <description>&lt;P&gt;Thanks for the reply!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is giving an error: A function "CONTAINS" has been used in a True/False expressions that is used as a table filter expression.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CONTAINS and CALCULATETABLE are new to me, I'll do some exploration with them and see if I can get the error corrected.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 16:12:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-records-based-on-two-dates-second-count-must-exclude/m-p/4365453#M173326</guid>
      <dc:creator>jbobeck</dc:creator>
      <dc:date>2025-01-15T16:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: Counting records based on two dates, second count must exclude records from the first</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-records-based-on-two-dates-second-count-must-exclude/m-p/4365461#M173328</link>
      <description>&lt;P&gt;I'll take a look at how to use EXCEPT.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data is very simple, I have a date dimension with sequential dates from 1950 - 2050.&amp;nbsp; The fact table is only 4 columns and is laid out like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;FactID&lt;/TD&gt;&lt;TD&gt;AddDT&lt;/TD&gt;&lt;TD&gt;EditDT&lt;/TD&gt;&lt;TD&gt;RecordValue&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1/1/2024&lt;/TD&gt;&lt;TD&gt;6/15/2024&lt;/TD&gt;&lt;TD&gt;ABC123&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2/16/2024&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;DEF456&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;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 2025 16:16:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-records-based-on-two-dates-second-count-must-exclude/m-p/4365461#M173328</guid>
      <dc:creator>jbobeck</dc:creator>
      <dc:date>2025-01-15T16:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: Counting records based on two dates, second count must exclude records from the first</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-records-based-on-two-dates-second-count-must-exclude/m-p/4365786#M173348</link>
      <description>&lt;P&gt;I was able to use this as a basis and got it working:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edited Count =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;COUNTROWS(FactTable),&lt;BR /&gt;USERELATIONSHIP(DateTable[Date], FactTable[EditedDate]),&lt;BR /&gt;NOT(FactTable[RecordID] IN VALUES(FactTable[RecordID]))&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure how this is giving me the correct answer, but it must recognize the context that the two FactTable[RecordID]s are from different sets.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 21:06:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-records-based-on-two-dates-second-count-must-exclude/m-p/4365786#M173348</guid>
      <dc:creator>jbobeck</dc:creator>
      <dc:date>2025-01-15T21:06:17Z</dc:date>
    </item>
  </channel>
</rss>

