<?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 Identify if entry/record is part of 'streak' longer than x days in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identify-if-entry-record-is-part-of-streak-longer-than-x-days/m-p/3246633#M119620</link>
    <description>&lt;P&gt;I have a table holding data regarding absence. To simplify the table holds these columns:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;employee no (integer)&lt;BR /&gt;absence code (integer)&lt;BR /&gt;starting date (date)&lt;BR /&gt;ending date (date)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data going into this table is not necessarily for the whole period, but could be subsets, i.e. May 1 - May 5 and then again May 8 - May 12 (typically excluding weekend days).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would like to know if any entry is part of a streak that is &amp;gt;= 30 days to identify short term or long term absence. This based on combination of employee and absence code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ultimately I need to be able to slice, so I can filter and make measures based on short/term to calculate how much in percent points the short term and long term make up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I see it there could be 2 approaches:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) In PowerQuery try and group the start and end dates. Thinking I could offset Friday to Sunday to include the weekend days. Not sure how to join the periods though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) Or this could be done in DAX? Could this be accomplished through a calculated column?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice on how to achieve this? Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Mon, 22 May 2023 06:54:13 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-05-22T06:54:13Z</dc:date>
    <item>
      <title>Identify if entry/record is part of 'streak' longer than x days</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identify-if-entry-record-is-part-of-streak-longer-than-x-days/m-p/3246633#M119620</link>
      <description>&lt;P&gt;I have a table holding data regarding absence. To simplify the table holds these columns:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;employee no (integer)&lt;BR /&gt;absence code (integer)&lt;BR /&gt;starting date (date)&lt;BR /&gt;ending date (date)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data going into this table is not necessarily for the whole period, but could be subsets, i.e. May 1 - May 5 and then again May 8 - May 12 (typically excluding weekend days).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would like to know if any entry is part of a streak that is &amp;gt;= 30 days to identify short term or long term absence. This based on combination of employee and absence code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ultimately I need to be able to slice, so I can filter and make measures based on short/term to calculate how much in percent points the short term and long term make up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I see it there could be 2 approaches:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) In PowerQuery try and group the start and end dates. Thinking I could offset Friday to Sunday to include the weekend days. Not sure how to join the periods though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) Or this could be done in DAX? Could this be accomplished through a calculated column?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice on how to achieve this? Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 06:54:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identify-if-entry-record-is-part-of-streak-longer-than-x-days/m-p/3246633#M119620</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-22T06:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: Identify if entry/record is part of 'streak' longer than x days</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identify-if-entry-record-is-part-of-streak-longer-than-x-days/m-p/3246799#M119633</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a DAX calculated column please try&lt;/P&gt;
&lt;P&gt;Absence Type =&lt;BR /&gt;VAR T =&lt;BR /&gt;CALCULATETABLE (&lt;BR /&gt;'Table',&lt;BR /&gt;ALLEXCEPT ( 'Table', 'Table'[Employee No], 'Table'[Absence Code] )&lt;BR /&gt;)&lt;BR /&gt;VAR StartDate =&lt;BR /&gt;MINX ( T, 'Table'[Starting Date] )&lt;BR /&gt;VAR EndDate1 =&lt;BR /&gt;MAXX ( T, 'Table'[Ending Date] )&lt;BR /&gt;VAR EndDate2 =&lt;BR /&gt;SWITCH ( WEEKDAY ( EndDate1, 2 ), 5, EndDate1 + 2, 6, EndDate1 + 1, EndDate1 )&lt;BR /&gt;VAR AbsenceDuration =&lt;BR /&gt;DATEDIFF ( StartDate, EndDate2, DAY )&lt;BR /&gt;RETURN&lt;BR /&gt;IF ( AbsenceDuration &amp;gt;= 30, "Long Term", "Short Term" )&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 07:52:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Identify-if-entry-record-is-part-of-streak-longer-than-x-days/m-p/3246799#M119633</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-05-22T07:52:00Z</dc:date>
    </item>
  </channel>
</rss>

