<?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: Do calculation on different granularity and show results in different Granularity in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084353#M47366</link>
    <description>&lt;P&gt;Looks like this&amp;nbsp; is giving the correct result I will verify and let you know. Thank you very much for the support&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="106637" data-lia-user-login="jdbuchanan71" class="lia-mention lia-mention-user"&gt;jdbuchanan71&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 19 Sep 2021 07:29:06 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-09-19T07:29:06Z</dc:date>
    <item>
      <title>Do calculation on different granularity and show results in different Granularity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084319#M47357</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need support on below calculation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to show difference between Downtime_start and Downtime_end for Each ID. But the calculation should happen based on below conditions.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;- Under one ID you will have different downtime start times,&amp;nbsp;&lt;BR /&gt;&amp;nbsp;- for Each Start time you have different modified times&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So you need to do the calculation for unique Downtime_start and you need to consider the Downtime_start with Highest Modified time and for each unique Downtime_start you need to calculate the difference between start and end time and show the total in ID level.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope the requirement is clear.&lt;BR /&gt;&lt;BR /&gt;This is the sample data.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PBI file link&amp;nbsp;&lt;A href="https://drive.google.com/file/d/1rzL-rMAly6YHCmOwsHdXfSKa9GdR7hLQ/view?usp=sharing" target="_blank"&gt;https://drive.google.com/file/d/1rzL-rMAly6YHCmOwsHdXfSKa9GdR7hLQ/view?usp=sharing&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much in Advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Modified time&lt;/TD&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;DonwTime_Start&lt;/TD&gt;&lt;TD&gt;DownTime_End&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15/09/2021 6:07:14 AM&lt;/TD&gt;&lt;TD&gt;75&lt;/TD&gt;&lt;TD&gt;12/09/2021 6:07 AM&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/TD&gt;&lt;TD&gt;13/09/2021 6:11 AM&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15/09/2021 6:08:45 AM&lt;/TD&gt;&lt;TD&gt;75&lt;/TD&gt;&lt;TD&gt;12/09/2021 6:07 AM&lt;/TD&gt;&lt;TD&gt;15/09/2021 6:11:48 AM&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15/09/2021 6:12:15 AM&lt;/TD&gt;&lt;TD&gt;75&lt;/TD&gt;&lt;TD&gt;01/09/2021 6:11 AM&lt;/TD&gt;&lt;TD&gt;13/09/2021 6:11 AM&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15/09/2021 6:14:00 AM&lt;/TD&gt;&lt;TD&gt;75&lt;/TD&gt;&lt;TD&gt;01/09/2021 6:11 AM&lt;/TD&gt;&lt;TD&gt;15/09/2021 6:11:48 AM&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15/09/2021 6:17:10 AM&lt;/TD&gt;&lt;TD&gt;75&lt;/TD&gt;&lt;TD&gt;10/09/2021 6:16 AM&lt;/TD&gt;&lt;TD&gt;15/09/2021 6:16:21 AM&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15/09/2021 6:17 :15 AM&lt;/TD&gt;&lt;TD&gt;75&lt;/TD&gt;&lt;TD&gt;10/09/2021 6:16 AM&lt;/TD&gt;&lt;TD&gt;15/09/2021 6:16:21 AM&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;This is my current formula which gives me the correct result at Start date level in the report. But when I view the result in ID level this is not giving me the correct result.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Total Downtime = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR _max_modified_date =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MAX ( Issue_Tracker[Modified] ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ALL(Issue_Tracker),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VALUES(Issue_Tracker[DonwTime_Start])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR _selected_id =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SELECTEDVALUE (Issue_Tracker[ID])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR _start_time =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SELECTEDVALUE ( Issue_Tracker[DonwTime_Start] ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FILTER (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Issue_Tracker,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Issue_Tracker[Modified] = _max_modified_date &amp;amp;&amp;amp; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Issue_Tracker[ID] = _selected_id &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR _end_time =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SELECTEDVALUE ( Issue_Tracker[DownTime_End] ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FILTER (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Issue_Tracker,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Issue_Tracker[Modified] = _max_modified_date &amp;amp;&amp;amp; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Issue_Tracker[ID] = _selected_id&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR _result =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DATEDIFF ( _start_time, _end_time, DAY )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;_result&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 19 Sep 2021 06:37:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084319#M47357</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-19T06:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: Do calculation on different granularity and show results in different Granularity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084320#M47358</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;@Daxer-almighty&lt;BR /&gt;&lt;SPAN&gt;@daxer-almighty&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Sep 2021 05:40:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084320#M47358</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-19T05:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: Do calculation on different granularity and show results in different Granularity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084321#M47359</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="255913" data-lia-user-login="daxer-almighty" class="lia-mention lia-mention-user"&gt;daxer-almighty&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Sep 2021 05:41:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084321#M47359</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-19T05:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Do calculation on different granularity and show results in different Granularity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084324#M47360</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="315278" data-lia-user-login="VahidDM" class="lia-mention lia-mention-user"&gt;VahidDM&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Sep 2021 05:45:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084324#M47360</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-19T05:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: Do calculation on different granularity and show results in different Granularity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084325#M47361</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1522" data-lia-user-login="ImkeF" class="lia-mention lia-mention-user"&gt;ImkeF&lt;/a&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="137842" data-lia-user-login="powerbiblogic" class="lia-mention lia-mention-user"&gt;powerbiblogic&lt;/a&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="224094" data-lia-user-login="Asalk" class="lia-mention lia-mention-user"&gt;Asalk&lt;/a&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="109818" data-lia-user-login="mussaenda" class="lia-mention lia-mention-user"&gt;mussaenda&lt;/a&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="507" data-lia-user-login="parry2k" class="lia-mention lia-mention-user"&gt;parry2k&lt;/a&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="106637" data-lia-user-login="jdbuchanan71" class="lia-mention lia-mention-user"&gt;jdbuchanan71&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Sep 2021 05:51:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084325#M47361</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-19T05:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Do calculation on different granularity and show results in different Granularity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084349#M47364</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think something like this will give you what you are looking for.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Duration = 
VAR _Incidents =
    SUMMARIZE ( 'Table', 'Table'[ID], 'Table'[DonwTime_Start] )
VAR _AddModified = 
    ADDCOLUMNS ( _Incidents, "@MaxMod", CALCULATE ( MAX ( 'Table'[Modified time] ) ) )
VAR _AddEnd = 
    ADDCOLUMNS ( _AddModified, "@DTEnd", CALCULATE ( MAX ( 'Table'[DownTime_End] ), FILTER('Table', 'Table'[Modified time] = [@MaxMod] ) ) )
RETURN
    SUMX ( _AddEnd, DATEDIFF ( [DonwTime_Start], [@DTEnd], DAY ) )&lt;/LI-CODE&gt;
&lt;P&gt;Although, could you ignore the modified time and just use the max Downtime End for each unique Downtime Start?&amp;nbsp; That gives me the same answer.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Duration Ignore Modified = 
VAR _Incidents =
    SUMMARIZE ( 'Table', 'Table'[ID], 'Table'[DonwTime_Start] )
VAR _AddEnd = 
    ADDCOLUMNS ( _Incidents, "@DTEnd", CALCULATE ( MAX ( 'Table'[DownTime_End] ) ) )
RETURN
    SUMX ( _AddEnd, DATEDIFF ( [DonwTime_Start], [@DTEnd], DAY ) )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Sep 2021 07:16:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084349#M47364</guid>
      <dc:creator>jdbuchanan71</dc:creator>
      <dc:date>2021-09-19T07:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: Do calculation on different granularity and show results in different Granularity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084352#M47365</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I created a new measure:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total Downtime Period = 
VAR __RESULT = 
    SUMX(
        SUMMARIZE(Issue_Tracker, Issue_Tracker[ID] , Issue_Tracker[DonwTime_Start]),
        VAR __MAXMOD = CALCULATE( MAX(Issue_Tracker[Modified time]))
        VAR __ENDTIME = CALCULATE( MAX(Issue_Tracker[DownTime_End]) , Issue_Tracker[Modified time] = __MAXMOD )
        RETURN
            DATEDIFF( Issue_Tracker[DonwTime_Start] , __ENDTIME , DAY )
    )
RETURN
__RESULT

&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Sep 2021 07:25:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084352#M47365</guid>
      <dc:creator>Fowmy</dc:creator>
      <dc:date>2021-09-19T07:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: Do calculation on different granularity and show results in different Granularity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084353#M47366</link>
      <description>&lt;P&gt;Looks like this&amp;nbsp; is giving the correct result I will verify and let you know. Thank you very much for the support&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="106637" data-lia-user-login="jdbuchanan71" class="lia-mention lia-mention-user"&gt;jdbuchanan71&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Sep 2021 07:29:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084353#M47366</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-19T07:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Do calculation on different granularity and show results in different Granularity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084354#M47367</link>
      <description>&lt;P&gt;Thank you very much&amp;nbsp;&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;Thank you very much for the support.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Sep 2021 07:44:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084354#M47367</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-19T07:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Do calculation on different granularity and show results in different Granularity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084355#M47368</link>
      <description>&lt;P&gt;Thank you very much&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="106637" data-lia-user-login="jdbuchanan71" class="lia-mention lia-mention-user"&gt;jdbuchanan71&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Sep 2021 07:45:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Do-calculation-on-different-granularity-and-show-results-in/m-p/2084355#M47368</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-19T07:45:48Z</dc:date>
    </item>
  </channel>
</rss>

