<?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: How can I track multiple time differences simultaneously based on another column? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1755440#M36638</link>
    <description>&lt;P&gt;You can AVERAGE()&amp;nbsp; the duration for each eligible ID to arrive at the working time.&lt;/P&gt;</description>
    <pubDate>Tue, 30 Mar 2021 17:35:08 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2021-03-30T17:35:08Z</dc:date>
    <item>
      <title>How can I track multiple time differences simultaneously based on another column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1724696#M35693</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need help in tracking multiple smiultaneous timestamps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a simple table like the one attached.&lt;/P&gt;&lt;P&gt;&lt;A href="https://i.stack.imgur.com/DtuaH.png" target="_blank" rel="nofollow noopener noreferrer"&gt;Table with columns Person ID, Time, Worktype and Index&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a table that is created when an employee (Person ID column) logs when starting to work at a particular position (Worktype column), combines positions, splits positions, goes on a break or goes home.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to track both the total time an employee has worked in any position (POSITION-A, B, SOUTH, WEST etc.) and the time worked in each position separately and also the time spent on breaks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Combining and splitting of positions complicates things. For example an employee might start working at POSITION-A, then combine POSITION-A and B, then continue only on POSITION-A and then go on a BREAK. In this scenario the employee should have working time at POSITION-A for the entire session and at POSITION-B only from the period that the positions were combined. There are also several options instead of a BREAK where the employee can go to, for example OFFICE or OFFWORK.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm able to calculate the time difference between two consecutive Worktype stamps of the same person with the following code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Elapse btw stamp and previous stamp (min) = 

VAR _curTime =
    myTable[Time]

VAR _pasttime =
    CALCULATE (
        Max(myTable[Time]) ,
        myTable[Time] &amp;lt; _curTime,  
        ALLEXCEPT (myTable, myTable[Person ID])
        )

VAR _dif = 
    IF(ISBLANK(_pasttime), 0 ,DATEDIFF ( _pasttime, _curTime, MINUTE ))

RETURN_dif&lt;/PRE&gt;&lt;P&gt;This is what the table looks like at the moment.&lt;/P&gt;&lt;P&gt;&lt;A href="https://i.stack.imgur.com/2550I.png" target="_blank" rel="nofollow noopener noreferrer"&gt;Table with "Elapse btw stamp and previous stamp"&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I can't figure out is how to put the elapsed time and the name of the person on the same row so I can get the correct info on how many minutes the person was on a break (Index 6) or at a certain position. Also I don't know how to take into account combined positions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be highly appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Mar 2021 09:50:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1724696#M35693</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-16T09:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: How can I track multiple time differences simultaneously based on another column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1740882#M36178</link>
      <description>&lt;P&gt;If you can live with minute level granularity (ie not down to the second) then you can use GENERATESERIES and INTERSECT/EXCEPT approach to collect the number of minutes for each position regardless of they are combined or not.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 00:53:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1740882#M36178</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2021-03-24T00:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: How can I track multiple time differences simultaneously based on another column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1741570#M36194</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for replying. Yes, minute level is accurate enough. I am not very competent with DAX so could you elaborate on how to exactly use those functions in my situation?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I noticed that I probably wasn't as clear as I could have been in my original post so I apologize for that. Here is a simplified table that hopefully clarifies what I am trying to accomplish.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 07:08:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1741570#M36194</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-24T07:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can I track multiple time differences simultaneously based on another column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1742622#M36212</link>
      <description>&lt;P&gt;Please provide the sample data in usable form (not as a picture) and I can show you the basic steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a similar topic where I have offered a potential solution&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/Calculate-Time-Occupied-Over-Call-during-an-Hour/m-p/1732606" target="_blank"&gt;Calculate Time Occupied Over Call during an Hour - Microsoft Power BI Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 13:02:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1742622#M36212</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2021-03-24T13:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: How can I track multiple time differences simultaneously based on another column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1743051#M36222</link>
      <description>&lt;P&gt;Hello&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;There is already a solution similar to your case that can be found &lt;A href="https://community.powerbi.com/t5/Desktop/Time-difference-between-next-row/m-p/338621" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;In your case just use&amp;nbsp;DATEDIFF function in RETURN part with MINUTE as interval.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 15:22:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1743051#M36222</guid>
      <dc:creator>ERD</dc:creator>
      <dc:date>2021-03-24T15:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: How can I track multiple time differences simultaneously based on another column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1743589#M36242</link>
      <description>&lt;P&gt;Here is the simplified table:&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1b_wVYPIMyk0sG9GvyNpQVXd65G_ACYpN/view?usp=sharing" target="_blank" rel="noopener"&gt;Excel-file&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 18:40:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1743589#M36242</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-24T18:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: How can I track multiple time differences simultaneously based on another column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1744180#M36258</link>
      <description>&lt;P&gt;One quick question - what datetime locale is that data from?&lt;/P&gt;
&lt;P&gt;Also - do you need this as a measure or is a calculated column enough ( I assume it is)?&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 02:12:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1744180#M36258</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2021-03-25T02:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: How can I track multiple time differences simultaneously based on another column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1747061#M36341</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Times are Eastern European Standard Time and a calculated column is exactly what I'm looking for.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 06:01:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1747061#M36341</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-26T06:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: How can I track multiple time differences simultaneously based on another column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1747982#M36361</link>
      <description>&lt;P&gt;Then the DAX I posted should work. Adjust it to your actual table name.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 11:46:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1747982#M36361</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2021-03-26T11:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: How can I track multiple time differences simultaneously based on another column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1754756#M36611</link>
      <description>&lt;P&gt;It works perfectly! Thank you very much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also need to calculate duration when the person is working on any position. Should I make a separate forum post on this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I updated the sample date. What I need to calculate is the data in the "Working time" column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.google.com/spreadsheets/d/1b_wVYPIMyk0sG9GvyNpQVXd65G_ACYpN/edit#gid=1774107101" target="_blank" rel="noopener"&gt;Excel&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each entry has its own ID number ("ID column") so this can be used and when positions are combined, they get the same ID number. I need to calculate everything else except "OFFWORK", "BREAK" and "OFFICE".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 13:19:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1754756#M36611</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-30T13:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: How can I track multiple time differences simultaneously based on another column?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1755440#M36638</link>
      <description>&lt;P&gt;You can AVERAGE()&amp;nbsp; the duration for each eligible ID to arrive at the working time.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 17:35:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-can-I-track-multiple-time-differences-simultaneously-based/m-p/1755440#M36638</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2021-03-30T17:35:08Z</dc:date>
    </item>
  </channel>
</rss>

