<?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 calculation between non consecutives rows in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculation-between-non-consecutives-rows/m-p/4027665#M159110</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I am trying to calculate the total hours and months between service gaps for each employee. I am creating a list of employees who qualify for a benefit. I thought identifying the last gap to reset the count of months and hours was enough, but I realized an employee qualifies if they meet the rules even if they have a gap in service later.&lt;/P&gt;&lt;P&gt;Could you guys help me out?&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Jul 2024 22:56:46 GMT</pubDate>
    <dc:creator>FelipeScheihing</dc:creator>
    <dc:date>2024-07-05T22:56:46Z</dc:date>
    <item>
      <title>calculation between non consecutives rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculation-between-non-consecutives-rows/m-p/4027665#M159110</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I am trying to calculate the total hours and months between service gaps for each employee. I am creating a list of employees who qualify for a benefit. I thought identifying the last gap to reset the count of months and hours was enough, but I realized an employee qualifies if they meet the rules even if they have a gap in service later.&lt;/P&gt;&lt;P&gt;Could you guys help me out?&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2024 22:56:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculation-between-non-consecutives-rows/m-p/4027665#M159110</guid>
      <dc:creator>FelipeScheihing</dc:creator>
      <dc:date>2024-07-05T22:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: calculation between non consecutives rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculation-between-non-consecutives-rows/m-p/4028333#M159160</link>
      <description>&lt;P&gt;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;&lt;BR /&gt;Do not include sensitive information or anything not related to the issue or question. &lt;BR /&gt;&lt;BR /&gt;If you are unsure how to upload data please refer to &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;&lt;BR /&gt;Please show the expected outcome based on the sample data you provided. &lt;BR /&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>Sat, 06 Jul 2024 20:58:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculation-between-non-consecutives-rows/m-p/4028333#M159160</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-07-06T20:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: calculation between non consecutives rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculation-between-non-consecutives-rows/m-p/4029649#M159275</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thanks for the reply from&lt;/SPAN&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&lt;SPAN&gt;&amp;nbsp;,&lt;/SPAN&gt;please allow me to provide another insight:&lt;/P&gt;
&lt;P&gt;HI,&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="486809" data-lia-user-login="FelipeScheihing" class="lia-mention lia-mention-user"&gt;FelipeScheihing&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Regarding the issue you raised, my solution is as follows:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;1.First I have created the following table and the column names and data are the data you have given:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;2.Create calculated column references:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;predate =
VAR currentdate = 'kk'[date]
RETURN
    IF (
        'kk'[gap] = "gap",
        MAXX (
            FILTER (
                'kk',
                'kk'[gap] = "gap"
                    &amp;amp;&amp;amp; 'kk'[date] &amp;lt; currentdate
                    &amp;amp;&amp;amp; 'kk'[id] = EARLIER ( kk[id] )
            ),
            'kk'[date]
        ),
        BLANK ()
    )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;diffhour = DATEDIFF('kk'[predate],'kk'[date].[Date],HOUR)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;diffmonth = DATEDIFF('kk'[predate],'kk'[date].[Date],MONTH)&lt;/LI-CODE&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;3.Here's my final result, which I hope meets your requirements.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;4.Here is the relevant documentation:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/datediff-function-dax" target="_blank"&gt;&lt;SPAN&gt;DATEDIFF function (DAX) - DAX | Microsoft Learn&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Please find the attached pbix relevant to the case.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Leroy Lu&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;If this post &lt;SPAN&gt;helps&lt;/SPAN&gt;, then please consider Accept it &lt;SPAN&gt;as the solution &lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2024 08:09:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculation-between-non-consecutives-rows/m-p/4029649#M159275</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-08T08:09:36Z</dc:date>
    </item>
  </channel>
</rss>

