<?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: Calculate Hour Type Column Difference in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3021045#M102780</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Firstly, thank you for your reply. That's true that I don't have a column with a specific order but, bearing in mind, we talk about game plays, I can add an index column (the order of the games is always the same, like the one shown in "Testing.xlsx").&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I added it for the game with the specific problem to help you to test the change (it's a extraction of the dataset with a column index added). The name of the folder is "Testing.xlsx" with the extraction of one game with the specific problem (different values for "Defensive Five" for the same "Time_Def" column value). I highlighted in yellow the specific rows that are problem for the code (it's not recurrent but can happen in some games).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess it's a change in the code already working but I tried different options but not working. Could you help me, please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 14 Jan 2023 21:00:18 GMT</pubDate>
    <dc:creator>sfernamer</dc:creator>
    <dc:date>2023-01-14T21:00:18Z</dc:date>
    <item>
      <title>Calculate Hour Type Column Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3006559#M101746</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I text you because I'm trying to calculate the difference between the hour values of the same column. The objective is to find the sum of time for every value of "Defensive Five" column:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- To find the difference between the cell below and the one above grouped by another columns (Game and Quarter).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess that I could use the DATEDIFF and LOOKUPVALUE but I'm not sure how I could use it bearing in mind that the Quarter starts witth value 10:00 and finish with 0:00.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To make the comprehension easier, I add a pic of the dataset (the first one) used and the calculation in Excel that offers the expected result (the one I want to get in Power BI with DAX).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second one is a grouped sum after the calculation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your time and your knowledge.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 21:40:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3006559#M101746</guid>
      <dc:creator>sfernamer</dc:creator>
      <dc:date>2023-01-06T21:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Hour Type Column Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3006758#M101757</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="490812" data-lia-user-login="sfernamer" class="lia-mention lia-mention-user"&gt;sfernamer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure if i fully get your, you may&lt;/P&gt;&lt;P&gt;1) add a column like this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Result = 
VAR _time =
MINX(
    FILTER(
        TableName,
        TableName[Game]=EARLIER(TableName[Game])
            &amp;amp;&amp;amp;TableName[Quarter]=EARLIER(TableName[Quarter])
            &amp;amp;&amp;amp;TableName[Time]&amp;gt;EARLIER(TableName[Time])
    ),
    TableName[Time]
) - [Time]
RETURN
IF([Time]=TIME(10,0,0), TIME(0,0,0), _time)&lt;/LI-CODE&gt;&lt;P&gt;2) write a measure like this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;SumTime = 
CONVERT(
    SUMX(
        TableName,
        CONVERT(TableName[Result], DOUBLE)
    ),
    DATETIME
)&lt;/LI-CODE&gt;&lt;P&gt;i tried with a simplified dataset and it worked like this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jan 2023 04:55:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3006758#M101757</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-01-07T04:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Hour Type Column Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3006830#M101761</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="490812" data-lia-user-login="sfernamer" class="lia-mention lia-mention-user"&gt;sfernamer&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Please create a new calculated column&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Expected Result =
VAR CurrentTime = 'Table'[Time]
VAR CurrentTable =
    CALCULATETABLE (
        'Table',
        ALLEXCEPT ( 'Table', 'Table'[GAme], 'Table'[Quarter] )
    )
VAR TableAfter =
    FILTER ( CurrentTable, 'Table'[Time] &amp;gt; CurrentTime )
VAR NextTime =
    COALESCE ( MINX ( TableAfter, 'Table'[Time] ), CurrentTime )
RETURN
    NextTime - CurrentTime&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 07 Jan 2023 08:34:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3006830#M101761</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-01-07T08:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Hour Type Column Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3007094#M101800</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp; / &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="460868" data-lia-user-login="FreemanZ" class="lia-mention lia-mention-user"&gt;FreemanZ&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your replies. I would like to apologize because I made an error with the "expected result". What I want is to have the result bearing in mind the cell above, not below (add the example, with the correction). &lt;STRONG&gt;Could you help me, to modify the formula?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tested your formulas and the&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="460868" data-lia-user-login="FreemanZ" class="lia-mention lia-mention-user"&gt;FreemanZ&lt;/a&gt;&amp;nbsp;gave me the expected result bearing in mind my mistake.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="460868" data-lia-user-login="FreemanZ" class="lia-mention lia-mention-user"&gt;FreemanZ&lt;/a&gt;&amp;nbsp;, I tested your 2n part of the formula but didn't work for me. As you can see in the 2nd image, the Sum_Time should be 1:32 but the calculation gives me more than 16 minutes. When I try to put the measure in mm:ss, the option is not allowed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&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>Sat, 07 Jan 2023 20:11:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3007094#M101800</guid>
      <dc:creator>sfernamer</dc:creator>
      <dc:date>2023-01-07T20:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Hour Type Column Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3007099#M101801</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="490812" data-lia-user-login="sfernamer" class="lia-mention lia-mention-user"&gt;sfernamer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try&lt;/P&gt;
&lt;P&gt;Expected Result =&lt;BR /&gt;VAR CurrentTime = 'Table'[Time]&lt;BR /&gt;VAR CurrentTable =&lt;BR /&gt;CALCULATETABLE (&lt;BR /&gt;'Table',&lt;BR /&gt;ALLEXCEPT ( 'Table', 'Table'[GAme], 'Table'[Quarter] )&lt;BR /&gt;)&lt;BR /&gt;VAR TableBefore =&lt;BR /&gt;FILTER ( CurrentTable, 'Table'[Time] &amp;lt; CurrentTime )&lt;BR /&gt;VAR PreviousTime =&lt;BR /&gt;MAXX ( TableBefore, 'Table'[Time] )&lt;BR /&gt;RETURN&lt;BR /&gt;CurrentTime - PreviousTime&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jan 2023 20:17:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3007099#M101801</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-01-07T20:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Hour Type Column Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3007672#M101866</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your reply. Looks like &lt;STRONG&gt;it works but not for all cases&lt;/STRONG&gt;. I tested it and mark the wrong cells in yellow.&lt;/P&gt;&lt;P&gt;I would like to know how I could group by the obtained values. The calculation gives me the value for every single "Defensive Five" but there are some defensive fives that could be repeated. Like using GROUP BY in SQL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you tell me, please, &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="460868" data-lia-user-login="FreemanZ" class="lia-mention lia-mention-user"&gt;FreemanZ&lt;/a&gt;&amp;nbsp;&amp;nbsp;? Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2023 21:21:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3007672#M101866</guid>
      <dc:creator>sfernamer</dc:creator>
      <dc:date>2023-01-09T21:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Hour Type Column Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3009857#M102012</link>
      <description>&lt;P&gt;I would like to add a sample of the dataset with 2 games and the columns related available to create the logic, to try to help. The Google Drive link to access to the Excel file:&amp;nbsp;&lt;A href="https://drive.google.com/drive/folders/1SlzwO6bgBBgrftwrVPGRVBE9KkIy_YqJ?usp=share_link" target="_blank" rel="noopener"&gt;https://drive.google.com/drive/folders/1SlzwO6bgBBgrftwrVPGRVBE9KkIy_YqJ?usp=share_link&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;/&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="460868" data-lia-user-login="FreemanZ" class="lia-mention lia-mention-user"&gt;FreemanZ&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2023 21:50:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3009857#M102012</guid>
      <dc:creator>sfernamer</dc:creator>
      <dc:date>2023-01-09T21:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Hour Type Column Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3011618#M102123</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="490812" data-lia-user-login="sfernamer" class="lia-mention lia-mention-user"&gt;sfernamer&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;If I correctly understand, the following should work&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Expected Result =
VAR CurrentTime1 = 'Table'[Time]
VAR CurrentTable =
    CALCULATETABLE (
        'Table',
        ALLEXCEPT ( 'Table', 'Table'[GAme], 'Table'[Quarter] )
    )
VAR CurrentDefensive5Table =
    TOPN ( 1, TableBefore, 'Table'[Time] )
VAR CurrentTime2 =
    SUMX ( CurrentDefensive5Table, 'Table'[Time] )
VAR TableBefore =
    FILTER ( CurrentTable, 'Table'[Time] &amp;lt; CurrentTime )
VAR PreviousDefensive5Table =
    TOPN ( 1, TableBefore, 'Table'[Time] )
VAR PreviousTime =
    SUMX ( PreviousDefensive5Table, 'Table'[Time] )
RETURN
    CurrentTime2 - PreviousTime&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 10 Jan 2023 15:41:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3011618#M102123</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-01-10T15:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Hour Type Column Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3014880#M102355</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried your last code but it's not working. I'm not sure about the parts of "TableBefore" and "CurrentTime", bearing in mind the variables are not created before in the code. All data is located in the same table. If you feel more comfortable, you can take the Excel in the lines below where I show you a piece of the dataset and the expected results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Google Drive Link:&amp;nbsp;&lt;A href="https://drive.google.com/drive/folders/1SlzwO6bgBBgrftwrVPGRVBE9KkIy_YqJ?usp=share_link" target="_blank"&gt;https://drive.google.com/drive/folders/1SlzwO6bgBBgrftwrVPGRVBE9KkIy_YqJ?usp=share_link&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example of the expected Result with a Game (ExpectedResult Tab in xlsx). The ExpectedResult is calculated with the difference between the cell and the one above, bearing in mind the end of quarters or the change in games.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once we could calculate the ExpectedResult value, I would like to sum up the value (like it was a Pivot Table in Excel):&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 21:10:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3014880#M102355</guid>
      <dc:creator>sfernamer</dc:creator>
      <dc:date>2023-01-11T21:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Hour Type Column Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3014929#M102359</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="460868" data-lia-user-login="FreemanZ" class="lia-mention lia-mention-user"&gt;FreemanZ&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried your code and worked but I made a mistake when defining the problem. I didn't need that the cell contained the calculation like the way I told, I need that the cell contains the difference between the line in the same row and the row above, bearing in mind the change of quarter and the change in game.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All data is located in the same table. If you feel more comfortable, you can take the Excel in the lines below where I show you a piece of the dataset and the expected results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Google Drive Link:&amp;nbsp;&lt;A href="https://drive.google.com/drive/folders/1SlzwO6bgBBgrftwrVPGRVBE9KkIy_YqJ?usp=share_link" target="_blank" rel="nofollow noopener noreferrer"&gt;https://drive.google.com/drive/folders/1SlzwO6bgBBgrftwrVPGRVBE9KkIy_YqJ?usp=share_link&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example of the expected Result with a Game (ExpectedResult Tab in xlsx). The ExpectedResult is calculated with the difference between the cell and the one above, bearing in mind the end of quarters or the change in games.&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;&lt;P&gt;Once we could calculate the ExpectedResult value, I would like to sum up the value (like it was a Pivot Table in Excel):&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 21:21:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3014929#M102359</guid>
      <dc:creator>sfernamer</dc:creator>
      <dc:date>2023-01-11T21:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Hour Type Column Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3015420#M102381</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="490812" data-lia-user-login="sfernamer" class="lia-mention lia-mention-user"&gt;sfernamer&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Here is a sample file containing my two previously proposed solutions. You are right about the 2nd solution, there was sime mistakes. Not sure if either what you're looking for.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 02:30:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3015420#M102381</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-01-12T02:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Hour Type Column Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3020833#M102765</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Firstly, thank you for your time, looks like the solution 1 is working for what I wanted except for 1 special situation. Sometimes, there can be more than one row with the same Time_Def field (changing 2 defensive fives at the same h:mm:ss). Checking the calculation, it's calculating the difference for each of them despite the fact that one of this fields should be 0:00:00 (there is no difference). I don't know if we have to add a line of code to choose the first in order when there are some files with the same h:mm:ss.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After this, I would need to sum up like in a Pivot Table I shown above (Idk if it's possible with sumx).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Add you the example in Excel (in the same link) and the expected result in image to see if you could help me, please.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jan 2023 16:01:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3020833#M102765</guid>
      <dc:creator>sfernamer</dc:creator>
      <dc:date>2023-01-14T16:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Hour Type Column Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3020849#M102769</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="490812" data-lia-user-login="sfernamer" class="lia-mention lia-mention-user"&gt;sfernamer&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;That can be done but you need a sort order as it seems that defensive five don't have a specific order. Please advise.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jan 2023 16:23:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3020849#M102769</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-01-14T16:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Hour Type Column Difference</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3021045#M102780</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Firstly, thank you for your reply. That's true that I don't have a column with a specific order but, bearing in mind, we talk about game plays, I can add an index column (the order of the games is always the same, like the one shown in "Testing.xlsx").&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I added it for the game with the specific problem to help you to test the change (it's a extraction of the dataset with a column index added). The name of the folder is "Testing.xlsx" with the extraction of one game with the specific problem (different values for "Defensive Five" for the same "Time_Def" column value). I highlighted in yellow the specific rows that are problem for the code (it's not recurrent but can happen in some games).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess it's a change in the code already working but I tried different options but not working. Could you help me, please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jan 2023 21:00:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Hour-Type-Column-Difference/m-p/3021045#M102780</guid>
      <dc:creator>sfernamer</dc:creator>
      <dc:date>2023-01-14T21:00:18Z</dc:date>
    </item>
  </channel>
</rss>

