<?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 to Calculate time saved with overlapping time in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Calculate-time-saved-with-overlapping-time/m-p/1803650#M38070</link>
    <description>&lt;P&gt;Hi Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you want to perform these calculations per ProjectId, you can use a SUMX( VALUES(...), CALCULATE(...) ) type pattern:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Saved Time =
SUMX (
    VALUES ( Projects[ProjectId] ),
    CALCULATE ( SUM ( Projects[Seconds2] ) - MAX ( Projects[Seconds] ) )
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Scan Time Serial = 
SUMX ( 
    VALUES ( Projects[ProjectId] ),
    CALCULATE ( SUM ( Projects[Seconds2] ) + MAX ( Projects[Seconds] ) )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MAX is just an arbitrary aggregation for Projects[Seconds], since presumably this column contains a single distinct value for a given ProjectId.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do these give the result you expect?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Owen&lt;/P&gt;</description>
    <pubDate>Sat, 24 Apr 2021 09:07:04 GMT</pubDate>
    <dc:creator>OwenAuger</dc:creator>
    <dc:date>2021-04-24T09:07:04Z</dc:date>
    <item>
      <title>How to Calculate time saved with overlapping time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Calculate-time-saved-with-overlapping-time/m-p/1803124#M38040</link>
      <description>&lt;P&gt;I'm having a devil of time to figure out how to calculate the time difference between one scan and multiple overlapping scans. See example below.&lt;/P&gt;&lt;DIV class="s-table-container"&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ProjectId&lt;/TD&gt;&lt;TD&gt;ScanId&lt;/TD&gt;&lt;TD&gt;ScanId.1&lt;/TD&gt;&lt;TD&gt;StartedDate&lt;/TD&gt;&lt;TD&gt;CompletedDate&lt;/TD&gt;&lt;TD&gt;StartedDated.1&lt;/TD&gt;&lt;TD&gt;CompletedDate.1&lt;/TD&gt;&lt;TD&gt;Seconds&lt;/TD&gt;&lt;TD&gt;Seconds2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;8/04/2021 12:05:16 PM&lt;/TD&gt;&lt;TD&gt;8/04/2021 12:30:29 PM&lt;/TD&gt;&lt;TD&gt;8/04/2021 12:04:45 PM&lt;/TD&gt;&lt;TD&gt;8/04/2021 12:22:10 PM&lt;/TD&gt;&lt;TD&gt;1513&lt;/TD&gt;&lt;TD&gt;1045&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;8/04/2021 12:05:16 PM&lt;/TD&gt;&lt;TD&gt;8/04/2021 12:30:29 PM&lt;/TD&gt;&lt;TD&gt;8/04/2021 12:25:06 PM&lt;/TD&gt;&lt;TD&gt;8/04/2021 12:50:30 PM&lt;/TD&gt;&lt;TD&gt;1513&lt;/TD&gt;&lt;TD&gt;1524&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;ScanId is the "original" scan&lt;/LI&gt;&lt;LI&gt;ScanId.1 is the "overlapping" scan&lt;/LI&gt;&lt;LI&gt;The first set of date/time fields relate to the "original" scan&lt;/LI&gt;&lt;LI&gt;The second set of date/time fields relate to the "overlapping" scan&lt;/LI&gt;&lt;LI&gt;You can see they are both on the same ProjectId&lt;/LI&gt;&lt;LI&gt;Lastly Seconds is the duration of the "original" scan&lt;/LI&gt;&lt;LI&gt;and Seconds2 is the duration of the "overlapping" scan.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to calculate the saved time by having overlapping scans. Something like&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;(SUM Seconds2) - one row of the Seconds&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;2569 - 1513 = 1056 seconds (17.5 min) saved&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the scans ran serially the calculation would be&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;Seconds + Seconds2 + Seconds2&lt;BR /&gt;1513 + 1045 + 1524 = 4082 seconds (68 min)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any assistance would be greatly appreciated&lt;/P&gt;</description>
      <pubDate>Fri, 23 Apr 2021 16:19:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Calculate-time-saved-with-overlapping-time/m-p/1803124#M38040</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-04-23T16:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to Calculate time saved with overlapping time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Calculate-time-saved-with-overlapping-time/m-p/1803650#M38070</link>
      <description>&lt;P&gt;Hi Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you want to perform these calculations per ProjectId, you can use a SUMX( VALUES(...), CALCULATE(...) ) type pattern:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Saved Time =
SUMX (
    VALUES ( Projects[ProjectId] ),
    CALCULATE ( SUM ( Projects[Seconds2] ) - MAX ( Projects[Seconds] ) )
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Scan Time Serial = 
SUMX ( 
    VALUES ( Projects[ProjectId] ),
    CALCULATE ( SUM ( Projects[Seconds2] ) + MAX ( Projects[Seconds] ) )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MAX is just an arbitrary aggregation for Projects[Seconds], since presumably this column contains a single distinct value for a given ProjectId.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do these give the result you expect?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Owen&lt;/P&gt;</description>
      <pubDate>Sat, 24 Apr 2021 09:07:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Calculate-time-saved-with-overlapping-time/m-p/1803650#M38070</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2021-04-24T09:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to Calculate time saved with overlapping time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Calculate-time-saved-with-overlapping-time/m-p/1813969#M38351</link>
      <description>&lt;P&gt;Thank you Owen. Your suggestion worked as designed.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 11:11:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Calculate-time-saved-with-overlapping-time/m-p/1813969#M38351</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-04-29T11:11:25Z</dc:date>
    </item>
  </channel>
</rss>

