<?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: Total Sum of hours not adding same time periods in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1599891#M32083</link>
    <description>&lt;P&gt;Hi!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the prosousal. Well line 5 is correct as Actor A can attend to record 2 hours of content A only and 2 hours for content AB but doing it alone. It was to show all possible combinations. Anyway I think your solution could work.&lt;/P&gt;&lt;P&gt;I was trying to avoid creating a new table and do it with a DAX meassure, easier to implement in my dataset as it has relation between tablesand other meassuers.&lt;/P&gt;&lt;P&gt;Anyway I'll try it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; thank a lot for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Jan 2021 15:29:00 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-01-14T15:29:00Z</dc:date>
    <item>
      <title>Total Sum of hours not adding same time periods</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1599249#M32050</link>
      <description>&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got a bit of struggle on this meassure. I got a table to track recording time of actors in the booth.&lt;/P&gt;&lt;P&gt;There are 2 actors and they can record 3 types of content. Content for A only, content for B only and content for both of them (AB). This third content (AB) can be recorded with both actors together in the booth or they can record it separated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to get the sum of the total hours, but avoiding to sum twice the hours when they attend together (same date and time)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The table looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The duplicated time I dont want to sum to calculate the total of hours is the orange case (rows 6 and 7), both are together recording. When they record separated despite is the same day but a different hours I want them to be in the total of hours.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was think I that a SUMX would do the job, but at the time to define the expresion I don't know what to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any clue? thanks!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 10:42:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1599249#M32050</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-01-14T10:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Total Sum of hours not adding same time periods</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1599488#M32055</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Can you share the expected results based on your sample above and explain how the hours that belong to both actors should be split?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;________________________&lt;/P&gt;&lt;P&gt;If my answer was helpful, please click &lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&lt;I&gt; to help other members find it useful&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Click on the &lt;STRONG&gt;Thumbs-Up icon &lt;/STRONG&gt;if you like this reply &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://www.excelfort.com" target="_blank"&gt;&lt;FONT color="blue"&gt;Website&lt;/FONT&gt;&lt;/A&gt; &lt;A href="https://www.youtube.com/channel/UCKwBEguA8IlBubIobaOormg?sub_confirmation=1" target="_blank"&gt;&lt;FONT color="blue"&gt;YouTube&lt;/FONT&gt;&lt;/A&gt;&amp;nbsp; &lt;A href="https://linkedin.com/in/fowmy" target="_blank"&gt;&lt;FONT color="blue"&gt;LinkedIn&lt;/FONT&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 12:24:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1599488#M32055</guid>
      <dc:creator>Fowmy</dc:creator>
      <dc:date>2021-01-14T12:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Total Sum of hours not adding same time periods</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1599493#M32058</link>
      <description>&lt;P&gt;Have you only got 2 actors, or more? Because I've got a simple idea that would work fine for just 2 actors.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 12:27:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1599493#M32058</guid>
      <dc:creator>lazarus1907</dc:creator>
      <dc:date>2021-01-14T12:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: Total Sum of hours not adding same time periods</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1599743#M32073</link>
      <description>&lt;P&gt;Hi!!&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="247833" data-lia-user-login="lazarus1907" class="lia-mention lia-mention-user"&gt;lazarus1907&lt;/a&gt;&amp;nbsp; well there are more actors, but just 2 are involved in recordings together... the rest of them will attenden alone.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 14:14:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1599743#M32073</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-01-14T14:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: Total Sum of hours not adding same time periods</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1599750#M32074</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="52518" data-lia-user-login="Fowmy" class="lia-mention lia-mention-user"&gt;Fowmy&lt;/a&gt;&amp;nbsp;Yes sure!!&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;It would result by adding the hours, and just in the case in orange 10:00 to 12:00 on the 04/01/2021 would be added just 2 hours instead of 4 hours...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hope I explained myself &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; thanks!!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 14:19:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1599750#M32074</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-01-14T14:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Total Sum of hours not adding same time periods</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1599761#M32075</link>
      <description>&lt;P&gt;OK, this is not exactly an elegant solution, and I'm assuming there are two players only, and you made a mistake on the 5th row, where you have A for actor, but AB for content type. So I'm using table A instead:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Now, if you go to modelling and then "Create Table", you can put this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Table = 
    VAR sec = GENERATESERIES(0, 86399, 1)
    VAR s = SUMMARIZE(
        'Data',
        'Data'[Time Start], 'Data'[Time End], 'Data'[Date],      
        "Correction",
            VAR d = Data[Date]
            VAR filter_a = FILTER(ALL(Data), Data[Date] = d &amp;amp;&amp;amp; Data[Actor] = "A")
            VAR filter_b = FILTER(ALL(Data), Data[Date] = d &amp;amp;&amp;amp; Data[Actor] = "B")
            VAR a_min = CALCULATE(MIN(Data[Time Start]), filter_a) *86400
            VAR a_max = CALCULATE(MAX(Data[Time End]), filter_a) * 86400
            VAR b_min = CALCULATE(MIN(Data[Time Start]), filter_b) * 86400
            VAR b_max = CALCULATE(MAX(Data[Time End]), filter_b) * 86400
            VAR filter_1 =  FILTER(sec, [value] &amp;lt; a_min || [Value] &amp;gt; a_max)
            VAR filter_2 =  FILTER(sec, [value] &amp;lt; a_min || [Value] &amp;gt; a_max)
            VAR filter_3 = FILTER(sec, ([value] &amp;gt;= a_min &amp;amp;&amp;amp; [Value] &amp;lt; a_max) || ([Value] &amp;gt;= b_min &amp;amp;&amp;amp; [Value] &amp;lt; b_max))
            RETURN ROUND(COUNTROWS(filter_3)/3600, 2)
    )
    RETURN s&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This new table is B.&lt;/P&gt;&lt;P&gt;Here, dates appear repeated when there is more than one actor per day (both will display the total for the day), but if you use only Date and Correction to create a visual, you get C:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not a brilliant solution, but it might give you some ideas. At least, when both are working at the same time, their hours are ony counted once. At least the total is 18.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I hope I didn't misunderstand you.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 14:32:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1599761#M32075</guid>
      <dc:creator>lazarus1907</dc:creator>
      <dc:date>2021-01-14T14:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: Total Sum of hours not adding same time periods</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1599891#M32083</link>
      <description>&lt;P&gt;Hi!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the prosousal. Well line 5 is correct as Actor A can attend to record 2 hours of content A only and 2 hours for content AB but doing it alone. It was to show all possible combinations. Anyway I think your solution could work.&lt;/P&gt;&lt;P&gt;I was trying to avoid creating a new table and do it with a DAX meassure, easier to implement in my dataset as it has relation between tablesand other meassuers.&lt;/P&gt;&lt;P&gt;Anyway I'll try it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; thank a lot for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 15:29:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1599891#M32083</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-01-14T15:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: Total Sum of hours not adding same time periods</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1600170#M32087</link>
      <description>&lt;P&gt;Maybe DAX can be used to detect any time range where both overlap on the same day, and subtract it from the total somehow, but even this can be tricky, because you could have [A, 2h, AB and] [A, 2h, AB], which normally would give a total of 4 h, but if both do it at once (e.g. 4/Jan/21), where do you subtract the 2 extra hours?&lt;BR /&gt;Person A gets 2 h and B 0? Both get 1h?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 16:57:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1600170#M32087</guid>
      <dc:creator>lazarus1907</dc:creator>
      <dc:date>2021-01-14T16:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: Total Sum of hours not adding same time periods</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1602406#M32139</link>
      <description>&lt;P&gt;Well, assign 50% of the time to each one would be a good one as well&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2021 15:48:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1602406#M32139</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-01-15T15:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Total Sum of hours not adding same time periods</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1606226#M32230</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="247833" data-lia-user-login="lazarus1907" class="lia-mention lia-mention-user"&gt;lazarus1907&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been trying but not sure why I'm not getting the correction column populated&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;also I'm wondering If I add other columns It will work... The sample table is a simplified one. The other colummns have the same values as they classify the content in other ways, but I need them to classify the hours.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 16:19:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1606226#M32230</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-01-18T16:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Total Sum of hours not adding same time periods</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1608701#M32302</link>
      <description>&lt;P&gt;Well I got to a solution but it doesn't work for totals... I created an ID for the attendances, concatenating the common values, this will generate the same IDs when the actors attend together to record, so the count of ID will determine the number of people in the booth. therefore I got to this DAX expresion:&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;both adjst = &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; SUMX(&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Data,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Data[Total hours]/COUNTAX(Data,SELECTEDVALUE(Data[ID]))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; )&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;Below you can see first the plain data and below it the aggregated table... but the total results in infinite... not sure way... at some point the COUNTAX expresion would return Cero I guess....&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;any help to fix this??&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>Tue, 19 Jan 2021 13:42:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Sum-of-hours-not-adding-same-time-periods/m-p/1608701#M32302</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-01-19T13:42:34Z</dc:date>
    </item>
  </channel>
</rss>

