<?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: MIN in GroupBy not working as expected in SUMMARIZE in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/MIN-in-GroupBy-not-working-as-expected-in-SUMMARIZE/m-p/1201549#M19225</link>
    <description>&lt;P&gt;Hi Pat,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the quick response.&amp;nbsp; Sadly that didn't make a different.&amp;nbsp; If you look at the example data in the post - you should be able to see the two rows where the to_status is dev done.&amp;nbsp; I want to make it so that I only have one instance of dev done in the table for that issue - with the earlier date of 02/12/19.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;</description>
    <pubDate>Sat, 04 Jul 2020 23:16:00 GMT</pubDate>
    <dc:creator>chipchidster</dc:creator>
    <dc:date>2020-07-04T23:16:00Z</dc:date>
    <item>
      <title>MIN in GroupBy not working as expected in SUMMARIZE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/MIN-in-GroupBy-not-working-as-expected-in-SUMMARIZE/m-p/1201530#M19221</link>
      <description>&lt;P&gt;I'm sure I am missing something very basic here but.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables (history &amp;amp; history_sprint_summary).&amp;nbsp; History stores all status changes for work items (stories) which relevant timestamps, etc.&amp;nbsp; History sprint summary is a summary table whose purpose is to show the first time a story went into each status.&amp;nbsp; This then drives reporting to show how much work a squad has done - give a particular end status.&amp;nbsp; I use a DAX SUMMARIZE expression to build the summary table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;history_sprint_summary = SUMMARIZE (&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; filter(history, history[sprint_to_date] &amp;lt;&amp;gt; BLANK()),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; history[issue_key],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; history[story_points],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; issues[project_key],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; issues[issue_id],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; issue_types[type],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; history[assignee],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; history[to_status],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "from_date", min( history[from_date] ),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "max_sprint_date", min( history[sprint_to_date]))&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;This has worked fine until recently, when a member of one of my squads accidently pushed a load of stories back through the workflow.&amp;nbsp; Now i am seeing duplicates in my summary table - my expectation is that the from_date and max_sprint_date would ensure i only get 1 row per status, per issue - so essentially i see the first time a story went into dev done.&amp;nbsp; I have pasted the data for one of the affected stories below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;issue_key&lt;/TD&gt;&lt;TD&gt;max_sprint_date&lt;/TD&gt;&lt;TD&gt;story_points&lt;/TD&gt;&lt;TD&gt;type&lt;/TD&gt;&lt;TD&gt;project_key&lt;/TD&gt;&lt;TD&gt;issue_id&lt;/TD&gt;&lt;TD&gt;to_status&lt;/TD&gt;&lt;TD&gt;from_date&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PROMO-103&lt;/TD&gt;&lt;TD&gt;02/12/2019 23:59&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;Story&lt;/TD&gt;&lt;TD&gt;PROMO&lt;/TD&gt;&lt;TD&gt;227916&lt;/TD&gt;&lt;TD&gt;in dev&lt;/TD&gt;&lt;TD&gt;19/11/2019 11:52&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PROMO-103&lt;/TD&gt;&lt;TD&gt;02/12/2019 23:59&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;Story&lt;/TD&gt;&lt;TD&gt;PROMO&lt;/TD&gt;&lt;TD&gt;227916&lt;/TD&gt;&lt;TD&gt;ready for dev&lt;/TD&gt;&lt;TD&gt;14/11/2019 17:10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PROMO-103&lt;/TD&gt;&lt;TD&gt;02/12/2019 23:59&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;Story&lt;/TD&gt;&lt;TD&gt;PROMO&lt;/TD&gt;&lt;TD&gt;227916&lt;/TD&gt;&lt;TD&gt;peer review&lt;/TD&gt;&lt;TD&gt;20/11/2019 09:48&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PROMO-103&lt;/TD&gt;&lt;TD&gt;02/12/2019 23:59&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;Story&lt;/TD&gt;&lt;TD&gt;PROMO&lt;/TD&gt;&lt;TD&gt;227916&lt;/TD&gt;&lt;TD&gt;qa&lt;/TD&gt;&lt;TD&gt;27/11/2019 12:21&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PROMO-103&lt;/TD&gt;&lt;TD&gt;02/12/2019 23:59&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;Story&lt;/TD&gt;&lt;TD&gt;PROMO&lt;/TD&gt;&lt;TD&gt;227916&lt;/TD&gt;&lt;TD&gt;release test/uat&lt;/TD&gt;&lt;TD&gt;28/11/2019 10:05&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PROMO-103&lt;/TD&gt;&lt;TD&gt;01/06/2020 23:59&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;Story&lt;/TD&gt;&lt;TD&gt;PROMO&lt;/TD&gt;&lt;TD&gt;227916&lt;/TD&gt;&lt;TD&gt;release test/uat&lt;/TD&gt;&lt;TD&gt;29/11/2019 12:57&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PROMO-103&lt;/TD&gt;&lt;TD&gt;29/06/2020 23:59&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;Story&lt;/TD&gt;&lt;TD&gt;PROMO&lt;/TD&gt;&lt;TD&gt;227916&lt;/TD&gt;&lt;TD&gt;dev done&lt;/TD&gt;&lt;TD&gt;29/05/2020 10:20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PROMO-103&lt;/TD&gt;&lt;TD&gt;02/12/2019 23:59&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;Story&lt;/TD&gt;&lt;TD&gt;PROMO&lt;/TD&gt;&lt;TD&gt;227916&lt;/TD&gt;&lt;TD&gt;dev done&lt;/TD&gt;&lt;TD&gt;29/11/2019 11:21&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PROMO-103&lt;/TD&gt;&lt;TD&gt;29/06/2020 23:59&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;Story&lt;/TD&gt;&lt;TD&gt;PROMO&lt;/TD&gt;&lt;TD&gt;227916&lt;/TD&gt;&lt;TD&gt;ready for live&lt;/TD&gt;&lt;TD&gt;16/06/2020 09:02&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PROMO-103&lt;/TD&gt;&lt;TD&gt;29/06/2020 23:59&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;Story&lt;/TD&gt;&lt;TD&gt;PROMO&lt;/TD&gt;&lt;TD&gt;227916&lt;/TD&gt;&lt;TD&gt;live proving&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;16/06/2020 09:05&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have previously tested this scenario - but only with dates that were a few weeks prior.&amp;nbsp; The only thing i can think of is that the dates for dev done are in different years - but it feels somewhat flaky if MIN can't handle year boundaries.&amp;nbsp; The max_sprint_date is a date hierarchy.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any thoughts would be greatful appreciated.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 04 Jul 2020 22:25:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/MIN-in-GroupBy-not-working-as-expected-in-SUMMARIZE/m-p/1201530#M19221</guid>
      <dc:creator>chipchidster</dc:creator>
      <dc:date>2020-07-04T22:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: MIN in GroupBy not working as expected in SUMMARIZE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/MIN-in-GroupBy-not-working-as-expected-in-SUMMARIZE/m-p/1201547#M19223</link>
      <description>&lt;P&gt;Please see if this variation on your table expression gets rid of your duplicate rows.&amp;nbsp; I assume since you are doing a MIN that you are getting the right DateTimes in your table (but just had duplicate rows of that).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;history_sprint_summary =
ADDCOLUMNS (
    DISTINCT (
        SUMMARIZE (
            FILTER ( history, history[sprint_to_date] &amp;lt;&amp;gt; BLANK () ),
            history[issue_key],
            history[story_points],
            issues[project_key],
            issues[issue_id],
            issue_types[type],
            history[assignee],
            history[to_status]
        )
    ),
    "from_date", CALCULATE ( MIN ( history[from_date] ) ),
    "max_sprint_date", CALCULATE ( MIN ( history[sprint_to_date] ) )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this works for you, please mark it as the solution.&amp;nbsp; Kudos are appreciated too.&amp;nbsp; Please let me know if not.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pat&lt;/P&gt;</description>
      <pubDate>Sat, 04 Jul 2020 23:03:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/MIN-in-GroupBy-not-working-as-expected-in-SUMMARIZE/m-p/1201547#M19223</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2020-07-04T23:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: MIN in GroupBy not working as expected in SUMMARIZE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/MIN-in-GroupBy-not-working-as-expected-in-SUMMARIZE/m-p/1201549#M19225</link>
      <description>&lt;P&gt;Hi Pat,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the quick response.&amp;nbsp; Sadly that didn't make a different.&amp;nbsp; If you look at the example data in the post - you should be able to see the two rows where the to_status is dev done.&amp;nbsp; I want to make it so that I only have one instance of dev done in the table for that issue - with the earlier date of 02/12/19.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;</description>
      <pubDate>Sat, 04 Jul 2020 23:16:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/MIN-in-GroupBy-not-working-as-expected-in-SUMMARIZE/m-p/1201549#M19225</guid>
      <dc:creator>chipchidster</dc:creator>
      <dc:date>2020-07-04T23:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: MIN in GroupBy not working as expected in SUMMARIZE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/MIN-in-GroupBy-not-working-as-expected-in-SUMMARIZE/m-p/1202233#M19268</link>
      <description>&lt;P&gt;Can you explain the issues and issue_type tables and how they relate to your history table?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pat]&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jul 2020 23:30:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/MIN-in-GroupBy-not-working-as-expected-in-SUMMARIZE/m-p/1202233#M19268</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2020-07-05T23:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: MIN in GroupBy not working as expected in SUMMARIZE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/MIN-in-GroupBy-not-working-as-expected-in-SUMMARIZE/m-p/1203232#M19292</link>
      <description>&lt;P&gt;Hi Pat&lt;/P&gt;&lt;P&gt;The datmaset is an extract from Jira (our work management system).&amp;nbsp; The tables are organised as follows:&lt;/P&gt;&lt;P&gt;issues - contains 1 record for each work item&lt;/P&gt;&lt;P&gt;issue_type - static table that contains the label value for issue types (e.g. story, spike, bug, etc)&lt;/P&gt;&lt;P&gt;history - contains a record for every status change to an issue (linked to issue by issue_id&lt;/P&gt;&lt;P&gt;history_sprint_summary - should contain one row for the first time an issue changes to a given status&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The primary key being used is the issue_id which is a GUID for this dataset.&amp;nbsp; In the summarize statement above - i am pulling in the additional fields to support easier report creation.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 09:10:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/MIN-in-GroupBy-not-working-as-expected-in-SUMMARIZE/m-p/1203232#M19292</guid>
      <dc:creator>chipchidster</dc:creator>
      <dc:date>2020-07-06T09:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: MIN in GroupBy not working as expected in SUMMARIZE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/MIN-in-GroupBy-not-working-as-expected-in-SUMMARIZE/m-p/1209826#M19455</link>
      <description>&lt;P&gt;Okay - so it would appear that i was being stupid (as i suspected i was).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason this was giving duplicates was because i had an assignee column in the summarize statement.&amp;nbsp; In this instance, two different assignees had moved the issue through the dev done status, and as such, summarize was counting those as unique instances.&amp;nbsp; Removed the assignee col, and hey presto - now i get one row per status.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jul 2020 17:53:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/MIN-in-GroupBy-not-working-as-expected-in-SUMMARIZE/m-p/1209826#M19455</guid>
      <dc:creator>chipchidster</dc:creator>
      <dc:date>2020-07-08T17:53:58Z</dc:date>
    </item>
  </channel>
</rss>

