<?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: Using COUNTX to Identify how many times a date in a date dimension table lies between time periods in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-COUNTX-to-Identify-how-many-times-a-date-in-a-date/m-p/2697534#M81477</link>
    <description>&lt;P&gt;Thanks for getting back to me, appreciate your speediness!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just to clarify in your initial paragraph, so for each absence, have as many rows as there are days absent in each absence event?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know if there's an easy way to create this? in my current absence table I have 17,000 rows of absence events.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Aug 2022 13:57:53 GMT</pubDate>
    <dc:creator>JamesLindsay101</dc:creator>
    <dc:date>2022-08-12T13:57:53Z</dc:date>
    <item>
      <title>Using COUNTX to Identify how many times a date in a date dimension table lies between time periods</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-COUNTX-to-Identify-how-many-times-a-date-in-a-date/m-p/2694947#M81268</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently trying to find out how many times in a date table, each date lands within a table of absences.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a date dimension table, pretty standard, and the absence table includes a start and end date of each absence.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to put together a COUNT formula of some kind which counts each time a date in the date dimension table lands in between (inclusive) of each of the start and end dates in the absence table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've currently got the below:&lt;/P&gt;&lt;P&gt;Absences is my absence table and Sickness Days Date Dimension is my date dimension table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Total Sickness Days by Day = CALCULATE(COUNTX(Absences,filter(CROSSJOIN(Absences,'Sickness Days Date Dimension'),'Sickness Days Date Dimension'[Date] &amp;gt;= Absences[Absence Start Date] &amp;amp;&amp;amp; 'Sickness Days Date Dimension'[Date]&amp;lt;= Absences[Absence End Date])))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I am getting the below error which I assume comes from the CROSSJOIN function but if I don't inhclude that I can't filter using both tables.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;any help? &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Note I can't share data as it is confidential data.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 11 Aug 2022 10:35:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-COUNTX-to-Identify-how-many-times-a-date-in-a-date/m-p/2694947#M81268</guid>
      <dc:creator>JamesLindsay101</dc:creator>
      <dc:date>2022-08-11T10:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using COUNTX to Identify how many times a date in a date dimension table lies between time periods</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-COUNTX-to-Identify-how-many-times-a-date-in-a-date/m-p/2695169#M81289</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="391142" data-lia-user-login="JamesLindsay101" class="lia-mention lia-mention-user"&gt;JamesLindsay101&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just create a table in which you'll store each and every day for any of the absences (meaning, between an absence's start and end date). Then you can even create a connection between your date dimension table and the new one. Once you've got this, it'll be dead easy to calculate anything because your calendar will be filtering the new table (call it ExpandedAbsences, should be hidden).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For instance, say you select one date from your date dim and want to know how many absences there were on this very day. This is the measure that does it:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[# Absences] = distinctcount( ExpandedAbsences[AbsenceId] ).&amp;nbsp; // AbsenceId links ExpandedAbsences to Absences.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How simple is that, huh?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2022 12:35:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-COUNTX-to-Identify-how-many-times-a-date-in-a-date/m-p/2695169#M81289</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-08-11T12:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using COUNTX to Identify how many times a date in a date dimension table lies between time periods</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-COUNTX-to-Identify-how-many-times-a-date-in-a-date/m-p/2697534#M81477</link>
      <description>&lt;P&gt;Thanks for getting back to me, appreciate your speediness!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just to clarify in your initial paragraph, so for each absence, have as many rows as there are days absent in each absence event?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know if there's an easy way to create this? in my current absence table I have 17,000 rows of absence events.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 13:57:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-COUNTX-to-Identify-how-many-times-a-date-in-a-date/m-p/2697534#M81477</guid>
      <dc:creator>JamesLindsay101</dc:creator>
      <dc:date>2022-08-12T13:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using COUNTX to Identify how many times a date in a date dimension table lies between time periods</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-COUNTX-to-Identify-how-many-times-a-date-in-a-date/m-p/2719508#M82870</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="391142" data-lia-user-login="JamesLindsay101" class="lia-mention lia-mention-user"&gt;JamesLindsay101&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for reaching out to us.&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt;&amp;nbsp;I have a date dimension table, and the absence table includes a start and end date of each absence.&lt;/P&gt;
&lt;P&gt;please share some sample data and the&amp;nbsp; expected output, thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Tang&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2022 08:36:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-COUNTX-to-Identify-how-many-times-a-date-in-a-date/m-p/2719508#M82870</guid>
      <dc:creator>v-xiaotang</dc:creator>
      <dc:date>2022-08-23T08:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using COUNTX to Identify how many times a date in a date dimension table lies between time periods</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-COUNTX-to-Identify-how-many-times-a-date-in-a-date/m-p/2720809#M82960</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My date dimension table is a usual date by date (DD/MM/YYYY) table, which also includes a calculated column identifying if the date is a weekday or a weekend.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My absence table a column for absence start dates, a column for absence end dates, and columns containing information regarding type of absence, and information on the employee who's absence it is. The quantity of days absent is automatically calculated by the HR information system.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;below is a small example of some rows of data...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Employee Status&lt;/TD&gt;&lt;TD&gt;Employee Number&lt;/TD&gt;&lt;TD&gt;First Name&lt;/TD&gt;&lt;TD&gt;Last Name&lt;/TD&gt;&lt;TD&gt;Start Date&lt;/TD&gt;&lt;TD&gt;Termination Date&lt;/TD&gt;&lt;TD&gt;Employee Type&lt;/TD&gt;&lt;TD&gt;Rank&lt;/TD&gt;&lt;TD&gt;Division (Label)&lt;/TD&gt;&lt;TD&gt;Absence Type&lt;/TD&gt;&lt;TD&gt;Absence Start Date&lt;/TD&gt;&lt;TD&gt;Absence End Date&lt;/TD&gt;&lt;TD&gt;Quantity of Days&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Active&lt;/TD&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;First1&lt;/TD&gt;&lt;TD&gt;Last1&lt;/TD&gt;&lt;TD&gt;01/01/2022&lt;/TD&gt;&lt;TD&gt;N/A&lt;/TD&gt;&lt;TD&gt;Permanent&lt;/TD&gt;&lt;TD&gt;Associate&lt;/TD&gt;&lt;TD&gt;Marketing&lt;/TD&gt;&lt;TD&gt;Illness&lt;/TD&gt;&lt;TD&gt;30/06/2022&lt;/TD&gt;&lt;TD&gt;05/07/2022&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Active&lt;/TD&gt;&lt;TD&gt;102&lt;/TD&gt;&lt;TD&gt;First2&lt;/TD&gt;&lt;TD&gt;Last2&lt;/TD&gt;&lt;TD&gt;01/11/2021&lt;/TD&gt;&lt;TD&gt;N/A&lt;/TD&gt;&lt;TD&gt;Fixed Term Worker&lt;/TD&gt;&lt;TD&gt;Associate&lt;/TD&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;TD&gt;Illness&lt;/TD&gt;&lt;TD&gt;04/07/2022&lt;/TD&gt;&lt;TD&gt;10/07/2022&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'm aiming for is a calculated column in my date dimension table which calculates how many times each date in my date dimension column is in between all the absences. For example, in the date dimension table where the date 04/07/2022 is, based on the example data above the calculated column should count 2, but for the date 30/06/2022 it should count 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if you need any further information from me, thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've also tried the below formula in a calculated column but this is erroring out ('USERELATIONSHIP function can only be used in the CALCULATE function'),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Total Sickness Days by Day = CALCULATE(COUNTROWS(Absences),USERELATIONSHIP('Sickness Days Date Dimension'[Date],Absences[Absence Start Date]) &amp;amp;&amp;amp; RELATED('Sickness Days Date Dimension'[Date]) &amp;gt;= Absences[Absence Start Date],USERELATIONSHIP('Sickness Days Date Dimension'[Date],Absences[Absence End Date]) &amp;amp;&amp;amp; RELATED('Sickness Days Date Dimension'[Date]) &amp;lt;= Absences[Absence End Date])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 24 Aug 2022 15:33:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-COUNTX-to-Identify-how-many-times-a-date-in-a-date/m-p/2720809#M82960</guid>
      <dc:creator>JamesLindsay101</dc:creator>
      <dc:date>2022-08-24T15:33:56Z</dc:date>
    </item>
  </channel>
</rss>

