<?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: datediff in HH:MM format in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/756461#M3022</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, I answered you..&lt;/P&gt;</description>
    <pubDate>Fri, 02 Aug 2019 14:30:36 GMT</pubDate>
    <dc:creator>elads</dc:creator>
    <dc:date>2019-08-02T14:30:36Z</dc:date>
    <item>
      <title>datediff in HH:MM format</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/754667#M2935</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two columns:&lt;BR /&gt;1. Start time&lt;BR /&gt;2. End time.&lt;/P&gt;&lt;P&gt;I want to know the duration of time between the two columns in hour and minute format&amp;nbsp;(HH:MM)&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I want to display their summary on the "CARD" in the same format.&lt;/P&gt;&lt;P&gt;Attached is a sample example.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Thank you so much for helping.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Alon&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 05:44:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/754667#M2935</guid>
      <dc:creator>elads</dc:creator>
      <dc:date>2019-08-01T05:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: datediff in HH:MM format</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/754913#M2940</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="85421" data-lia-user-login="elads" class="lia-mention lia-mention-user"&gt;elads&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;You can do something&amp;nbsp;like below, you can adjust the code to show only hh:mm if you wish, but the below will address&amp;nbsp;the issue of days when the sum goes over 24.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Measure = 
VAR _all = SUMX( 'Table', 'Table'[End] - 'Table'[Start] ) * 1
VAR _days  = INT( _all ) 
VAR _time = _all - _days 
RETURN  FORMAT( _days, "#0D-" ) &amp;amp; FORMAT( _time, "hh:mm:ss")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;Best Regards,&lt;BR /&gt;Mariusz&lt;BR /&gt;&lt;BR /&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;I&gt;Accepting it as the solution&lt;/I&gt;&lt;/STRONG&gt;.&lt;BR /&gt;&lt;BR /&gt;Please feel free to connect with me.&lt;BR /&gt;&lt;A href="https://www.linkedin.com/in/mariusz-repczynski-065a7362/" rel="nofollow noopener noreferrer" target="_blank"&gt;&lt;IMG src="https://ip1.i.lithium.com/1232d707bb27fc4afa3b81cd0702c478b6f7aced/68747470733a2f2f7374617469632e6c6963646e2e636f6d2f736364732f636f6d6d6f6e2f752f696d616765732f6c6f676f732f6c696e6b6564696e2f6c6f676f5f6c696e6b6564696e5f39337832315f76322e706e67" border="0" alt="Mariusz Repczynski" /&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 08:42:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/754913#M2940</guid>
      <dc:creator>Mariusz</dc:creator>
      <dc:date>2019-08-01T08:42:24Z</dc:date>
    </item>
    <item>
      <title>Re: datediff in HH:MM format</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/754920#M2941</link>
      <description>&lt;PRE&gt;Duration HH:MM:SS = 
// We start with a duration in number of seconds
VAR Duration = DATEDIFF( 'Table'[StartDate], 'Table'[EndDate], SECOND )
// There are 3,600 seconds in an hour
VAR Hours =
    INT ( Duration / 3600)
// There are 60 seconds in a minute
VAR Minutes =
    INT ( MOD( Duration - ( Hours * 3600 ),3600 ) / 60)
// Remaining seconds are the remainder of the seconds divided by 60 after subtracting out the hours 
VAR Seconds =
    ROUNDUP(MOD ( MOD( Duration - ( Hours * 3600 ),3600 ), 60 ),0) // We round up here to get a whole number
// These intermediate variables ensure that we have leading zero's concatenated onto single digits
// Hours with leading zeros
VAR H =
    IF ( LEN ( Hours ) = 1, 
        CONCATENATE ( "0", Hours ),
        CONCATENATE ( "", Hours )
      )
// Minutes with leading zeros
VAR M =
    IF (
        LEN ( Minutes ) = 1,
        CONCATENATE ( "0", Minutes ),
        CONCATENATE ( "", Minutes )
    )
// Seconds with leading zeros
VAR S =
    IF (
        LEN ( Seconds ) = 1,
        CONCATENATE ( "0", Seconds ),
        CONCATENATE ( "", Seconds )
    )
// Now return hours, minutes and seconds with leading zeros in the proper format "hh:mm:ss"
RETURN
    CONCATENATE (
        H,
        CONCATENATE ( ":", CONCATENATE ( M, CONCATENATE ( ":", S ) ) )
    )&lt;/PRE&gt;&lt;P&gt;This is code from:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Aggregating-Duration-Time/ba-p/22486" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Aggregating-Duration-Time/ba-p/22486&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 08:45:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/754920#M2941</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-01T08:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: datediff in HH:MM format</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/756071#M3006</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your answer,&lt;/P&gt;&lt;P&gt;The result is good, but I have to summarize the hours and minutes.&lt;BR /&gt;I don't seem to be able to do that because this field is text.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Alon&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 07:30:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/756071#M3006</guid>
      <dc:creator>elads</dc:creator>
      <dc:date>2019-08-02T07:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: datediff in HH:MM format</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/756095#M3008</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="85421" data-lia-user-login="elads" class="lia-mention lia-mention-user"&gt;elads&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Sorry, but who are you replying too?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;Best Regards,&lt;BR /&gt;Mariusz&lt;BR /&gt;&lt;BR /&gt;Please feel free to connect with me.&lt;BR /&gt;&lt;A href="https://www.linkedin.com/in/mariusz-repczynski-065a7362/" rel="nofollow noopener noreferrer" target="_blank"&gt;&lt;IMG src="https://ip1.i.lithium.com/1232d707bb27fc4afa3b81cd0702c478b6f7aced/68747470733a2f2f7374617469632e6c6963646e2e636f6d2f736364732f636f6d6d6f6e2f752f696d616765732f6c6f676f732f6c696e6b6564696e2f6c6f676f5f6c696e6b6564696e5f39337832315f76322e706e67" border="0" alt="Mariusz Repczynski" /&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 07:46:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/756095#M3008</guid>
      <dc:creator>Mariusz</dc:creator>
      <dc:date>2019-08-02T07:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: datediff in HH:MM format</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/756200#M3014</link>
      <description>Mate, a little bit of thinking goes a long way... If you have to summarize, then the measure should first add up all the seconds and then apply the above formula to this sum. Is this not obvious?&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;Darek</description>
      <pubDate>Fri, 02 Aug 2019 09:08:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/756200#M3014</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-02T09:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: datediff in HH:MM format</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/756461#M3022</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, I answered you..&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 14:30:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/756461#M3022</guid>
      <dc:creator>elads</dc:creator>
      <dc:date>2019-08-02T14:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: datediff in HH:MM format</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/756464#M3023</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, I answered you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="81408" data-lia-user-login="Mariusz" class="lia-mention lia-mention-user"&gt;Mariusz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 14:32:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/756464#M3023</guid>
      <dc:creator>elads</dc:creator>
      <dc:date>2019-08-02T14:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: datediff in HH:MM format</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/756467#M3024</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Do you have an example of such a calculation ..?&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 14:34:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/756467#M3024</guid>
      <dc:creator>elads</dc:creator>
      <dc:date>2019-08-02T14:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: datediff in HH:MM format</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/756469#M3025</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="85421" data-lia-user-login="elads" class="lia-mention lia-mention-user"&gt;elads&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The below Measure does the sum ( SUMX part ), the rest is just formatting&amp;nbsp;it to DD - HH:MM:SS, technically&amp;nbsp;you can use&amp;nbsp;SUMX( 'Table', 'Table'[End] - 'Table'[Start] ) * 1 part on its own, however this would give you only decimal value.&lt;/P&gt;&lt;PRE&gt;Measure = 
VAR _all = SUMX( 'Table', 'Table'[End] - 'Table'[Start] ) * 1
VAR _days  = INT( _all ) 
VAR _time = _all - _days 
RETURN  FORMAT( _days, "#0D-" ) &amp;amp; FORMAT( _time, "hh:mm:ss")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;Best Regards,&lt;BR /&gt;Mariusz&lt;BR /&gt;&lt;BR /&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;I&gt;Accepting it as the solution&lt;/I&gt;&lt;/STRONG&gt;.&lt;BR /&gt;&lt;BR /&gt;Please feel free to connect with me.&lt;BR /&gt;&lt;A href="https://www.linkedin.com/in/mariusz-repczynski-065a7362/" rel="nofollow noopener noreferrer" target="_blank"&gt;&lt;IMG src="https://ip1.i.lithium.com/1232d707bb27fc4afa3b81cd0702c478b6f7aced/68747470733a2f2f7374617469632e6c6963646e2e636f6d2f736364732f636f6d6d6f6e2f752f696d616765732f6c6f676f732f6c696e6b6564696e2f6c6f676f5f6c696e6b6564696e5f39337832315f76322e706e67" border="0" alt="Mariusz Repczynski" /&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 14:37:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/756469#M3025</guid>
      <dc:creator>Mariusz</dc:creator>
      <dc:date>2019-08-02T14:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: datediff in HH:MM format</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/756564#M3030</link>
      <description>Create a calculated column that for each row will store the number of seconds between the two dates. Then take the measure I've shown you and operate on the SUM of the column. So, you should create a measure like [Total Seconds] = SUM ( T[Seconds] ) and then use its value in my measure replacing the part which is responsible for calculating the seconds...&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;Darek</description>
      <pubDate>Fri, 02 Aug 2019 16:14:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/756564#M3030</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-02T16:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: datediff in HH:MM format</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/762821#M3266</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a calculated column that sums up the seconds between the two columns&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;sum_Diff_In_Second = sum(Table_Name[Diff_In_second])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Which part of your code should I replace not so clear ..?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 11:42:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/762821#M3266</guid>
      <dc:creator>elads</dc:creator>
      <dc:date>2019-08-09T11:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: datediff in HH:MM format</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/762837#M3269</link>
      <description>&lt;P&gt;&lt;SPAN&gt;"So, you should create a measure like [Total Seconds] = SUM ( T[Seconds] ) and then use its value in my measure replacing the part which is responsible for calculating the seconds..."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Use Its value in my measure replacing the part which calculates the seconds...&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I think this is as clear as the sun. Your "effort" is to find the part that calculates the seconds and substitute the value of the measure for the number of seconds. Can't be any simpler than that.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Darek&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 12:06:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/762837#M3269</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-09T12:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: datediff in HH:MM format</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/2423932#M64312</link>
      <description>&lt;P&gt;Thnaks for information&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 10:18:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/2423932#M64312</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-29T10:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: datediff in HH:MM format</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/3085250#M107788</link>
      <description>&lt;P&gt;This was a great solution. Worked like a charm!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 15:02:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/datediff-in-HH-MM-format/m-p/3085250#M107788</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-17T15:02:56Z</dc:date>
    </item>
  </channel>
</rss>

