<?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: Calculation between 2 dates based on the same value in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1543085#M30411</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="275205" data-lia-user-login="MathieuF" class="lia-mention lia-mention-user"&gt;MathieuF&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best if you can share the pbix&lt;/P&gt;
&lt;P&gt;You have to share the URL to the file hosted elsewhere: Dropbox, Onedrive... or just upload the file to a site like &lt;A href="http://www.tinyupload.com" target="_self"&gt;tinyupload.com&lt;/A&gt; (no sign-up required).&lt;/P&gt;
&lt;P&gt;And plese explain a bit more what exactly the result should look like. Is it in a visual per task_id? Something else?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Dec 2020 12:21:39 GMT</pubDate>
    <dc:creator>AlB</dc:creator>
    <dc:date>2020-12-10T12:21:39Z</dc:date>
    <item>
      <title>Calculation between 2 dates based on the same value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1542897#M30404</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am having difficulty implementing a calculation in Power BI.&lt;BR /&gt;I'm looking to calculate the time (Created_at) between the start of the action (Name: task.taken or task.resume) and the end of the action (Name: task.completed or task.transferred or task.expired_from_workbin) d 'an event (Task_id).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Created_at: date and time of the action&lt;BR /&gt;User_id: id of the individual&lt;BR /&gt;Name: nature of the action&lt;BR /&gt;Task_id: number of the event concerned by the action&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;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do you share the csv file?&lt;/P&gt;&lt;P&gt;Can you help me ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Mathieu&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 10:51:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1542897#M30404</guid>
      <dc:creator>MathieuF</dc:creator>
      <dc:date>2020-12-10T10:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation between 2 dates based on the same value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1543085#M30411</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="275205" data-lia-user-login="MathieuF" class="lia-mention lia-mention-user"&gt;MathieuF&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best if you can share the pbix&lt;/P&gt;
&lt;P&gt;You have to share the URL to the file hosted elsewhere: Dropbox, Onedrive... or just upload the file to a site like &lt;A href="http://www.tinyupload.com" target="_self"&gt;tinyupload.com&lt;/A&gt; (no sign-up required).&lt;/P&gt;
&lt;P&gt;And plese explain a bit more what exactly the result should look like. Is it in a visual per task_id? Something else?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 12:21:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1543085#M30411</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-12-10T12:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation between 2 dates based on the same value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1543111#M30412</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;Thank you for your help.&lt;BR /&gt;Sorry my english is not good: D&lt;BR /&gt;I want to calculate the sum of time spent on actions between start and end per individual (user_id).&lt;BR /&gt;Here is my CSV: &lt;A href="https://www.dropbox.com/s/qufloj2fob2srdc/journal_forum.csv?dl=0" target="_blank" rel="noopener"&gt;https://www.dropbox.com/s/qufloj2fob2srdc/journal_forum.csv?dl=0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and pbix &lt;A href="https://www.dropbox.com/s/jl10cuf3qvceo3j/test_journal.pbix?dl=0" target="_blank"&gt;https://www.dropbox.com/s/jl10cuf3qvceo3j/test_journal.pbix?dl=0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Mathieu&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 13:30:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1543111#M30412</guid>
      <dc:creator>MathieuF</dc:creator>
      <dc:date>2020-12-10T13:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation between 2 dates based on the same value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1543198#M30417</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="275205" data-lia-user-login="MathieuF" class="lia-mention lia-mention-user"&gt;MathieuF&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;1. Place user_id on a table visual&lt;/P&gt;
&lt;P&gt;2. Place this measure in the table. It will give you the time in minutes. Change if you want it in another unit&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
SUMX (
    DISTINCT ( Table1[task_id] ),
    VAR mint_ =
        CALCULATE (
            MIN ( Table1[Created_at] ),
            Table1[Name] IN { "task.taken", "task.resume" }
        )
    VAR maxt_ =
        CALCULATE (
            MAX ( Table1[Created_at] ),
            Table1[Name]
                IN { "task.completed", "task.transferred", "task.expired_from_workbin" }
        )
    RETURN
         ( maxt_ - mint_ ) * 24 * 60
)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 13:38:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1543198#M30417</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-12-10T13:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation between 2 dates based on the same value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1543229#M30420</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92178" data-lia-user-login="AlB" class="lia-mention lia-mention-user"&gt;AlB&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know if you saw, I put the pbix file.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 14:01:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1543229#M30420</guid>
      <dc:creator>MathieuF</dc:creator>
      <dc:date>2020-12-10T14:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation between 2 dates based on the same value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1543355#M30430</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="275205" data-lia-user-login="MathieuF" class="lia-mention lia-mention-user"&gt;MathieuF&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;There's no task.expired_from_workbin&lt;/FONT&gt;&lt;/STRONG&gt; in your data,&amp;nbsp; only task.expired_from_step??&lt;/P&gt;
&lt;P&gt;Had a quick look (see it all at work in the attached file). The measure seems to work fine for cases like ID&lt;/P&gt;
&lt;P&gt;541fe1360f4ca114df0000bc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but is slightly off at ID&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 56e1917d7765624c6b0001fd&lt;/P&gt;
&lt;P&gt;because task &lt;EM&gt;5fcfa098bd0e54813b1340de&lt;/EM&gt; &amp;nbsp; &amp;nbsp; appears in two instances ( taken-completed, resume-completed)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and yields negative numbers at cases like ID&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4fc675c20f4ca11924008111&lt;/P&gt;
&lt;P&gt;where the code works well but the data only has&amp;nbsp; a task.taken for&amp;nbsp; taskID 5fd0b96871336830f56f98f2, which messes the result up&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dealing with those cases will be trickier but the code can give you a good start. In any case you will need to exactly define all of the possible cases in&amp;nbsp;which the data can appear and, equally important, define how to deal with them&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 15:05:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1543355#M30430</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-12-10T15:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation between 2 dates based on the same value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1543411#M30436</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92178" data-lia-user-login="AlB" class="lia-mention lia-mention-user"&gt;AlB&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes it's normal. It is task.expired_from_workbin but it is not present in the example file.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The common point must be task_id and not user_id. The user_id is a filter.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 15:30:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1543411#M30436</guid>
      <dc:creator>MathieuF</dc:creator>
      <dc:date>2020-12-10T15:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation between 2 dates based on the same value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1557483#M30877</link>
      <description>&lt;P&gt;Hello @AIB,&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;BR /&gt;I have another question.&lt;BR /&gt;How do I make it take into account only the next action of the same task (task_id)?&lt;BR /&gt;Indeed, the 4 lines are the same tasks. Line 318 must go with line 376 and line 1202 with 2174.&lt;BR /&gt;With the given formula (and I thank you once again), calculate the time between line 318 and 2174, i.e. 155 minutes instead of 79 minutes (7 + 72).&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Mathieu&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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, 17 Dec 2020 18:58:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1557483#M30877</guid>
      <dc:creator>MathieuF</dc:creator>
      <dc:date>2020-12-17T18:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation between 2 dates based on the same value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1572255#M31346</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I advance a little bit ...&lt;/P&gt;&lt;P&gt;I managed to get the calculation of the first part but I cannot sum the 2 parts.&lt;/P&gt;&lt;P&gt;Namely from 8:44 am to 8:51 am + 10:08 am to 11:20 am.&lt;/P&gt;&lt;P&gt;7 + 72 min&lt;/P&gt;&lt;P&gt;How to do ?&lt;/P&gt;&lt;P&gt;Here is the new file.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Mathieu&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Fichiers: &lt;A href="https://www.dropbox.com/sh/61ae2dtbmobl8tp/AAATpy0sRBMGRziU0Xe7Sy_Za?dl=0" target="_blank"&gt;https://www.dropbox.com/sh/61ae2dtbmobl8tp/AAATpy0sRBMGRziU0Xe7Sy_Za?dl=0&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Dec 2020 16:10:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-between-2-dates-based-on-the-same-value/m-p/1572255#M31346</guid>
      <dc:creator>MathieuF</dc:creator>
      <dc:date>2020-12-28T16:10:33Z</dc:date>
    </item>
  </channel>
</rss>

