<?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: DAX Measure: group by min &amp;amp; if condition in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1316619#M23132</link>
    <description>&lt;P&gt;Please try this expression in a table visual with the Country and Name columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Min =&lt;BR /&gt;VAR thismin = [number]&lt;BR /&gt;VAR allmin =&lt;BR /&gt;MINX ( ALL ( Table1[Country], Table2[Name] ), [number] )&lt;BR /&gt;RETURN&lt;BR /&gt;IF ( thismin = allmin, 1, 0 )&lt;BR /&gt;&lt;BR /&gt;&lt;/P&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, 22 Aug 2020 21:58:29 GMT</pubDate>
    <dc:creator>mahoneypat</dc:creator>
    <dc:date>2020-08-22T21:58:29Z</dc:date>
    <item>
      <title>DAX Measure: group by min &amp; if condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1312654#M22944</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi PowerBI users,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have several dataset tables in PowerBI report. The column country comes from TABLE1 while the column name comes from TABLE2. The number is a measure.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;country&lt;/TD&gt;&lt;TD&gt;name&lt;/TD&gt;&lt;TD&gt;number&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;ICE&lt;/TD&gt;&lt;TD&gt;34&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;ICE&lt;/TD&gt;&lt;TD&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;WATER&lt;/TD&gt;&lt;TD&gt;18&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;ICE&lt;/TD&gt;&lt;TD&gt;26&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;ICE&lt;/TD&gt;&lt;TD&gt;89&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;WATER&lt;/TD&gt;&lt;TD&gt;32&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;WATER&lt;/TD&gt;&lt;TD&gt;31&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So firstly I want to calculate min_number based on country and name, and then if min_number = number, the min will be 1; otherwise, 0. So the result table looks like:&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;country&l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TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This is my code for min:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;min = 
VAR min_number =
    CALCULATE (
        MIN ( [number] ),
        ALLEXCEPT ( TABLE1, TABLE1[country] ), ALLEXCEPT (TABLE2, TABLE2[name])
    )
RETURN
    IF ( [number] = Min_number,1, 0 )&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I got an error: the MIN function only accepts a column reference as the argument number 1. Does it mean if it has to be one condition? how to fix it? Thank you&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2020 22:43:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1312654#M22944</guid>
      <dc:creator>qsong</dc:creator>
      <dc:date>2020-08-20T22:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure: group by min &amp; if condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1312673#M22949</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="181963" data-lia-user-login="qsong" class="lia-mention lia-mention-user"&gt;qsong&lt;/a&gt;&amp;nbsp;This looks like a measure aggregation problem. See my blog article about that here: &lt;A href="https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The pattern is: &lt;BR /&gt;MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])&lt;BR /&gt;MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])&lt;BR /&gt;AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])&lt;BR /&gt;etc.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2020 22:53:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1312673#M22949</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-08-20T22:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure: group by min &amp; if condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1312713#M22954</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;, thank you for your quick reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what happen if the groups come from different tables: TABLE1 and TABLE2?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2020 23:21:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1312713#M22954</guid>
      <dc:creator>qsong</dc:creator>
      <dc:date>2020-08-20T23:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure: group by min &amp; if condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1312910#M22961</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="181963" data-lia-user-login="qsong" class="lia-mention lia-mention-user"&gt;qsong&lt;/a&gt;&amp;nbsp;- Well I would expect that the two tables would have to be related, correct?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 01:31:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1312910#M22961</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-08-21T01:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure: group by min &amp; if condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1313190#M22966</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="181963" data-lia-user-login="qsong" class="lia-mention lia-mention-user"&gt;qsong&lt;/a&gt; , Can you provide data how it coming from both tables.&amp;nbsp; In Number is already min, no need for MIN. Else try MINX. refer&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;min = 
VAR min_number =
    CALCULATE (
        MINX (TABLE1, [number] ),
        ALLEXCEPT ( TABLE1, TABLE1[country] ), ALLEXCEPT (TABLE2, TABLE2[name])
    )
RETURN
    IF ( [number] = Min_number,1, 0 )&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 03:29:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1313190#M22966</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-08-21T03:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure: group by min &amp; if condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1314832#M23052</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;Yes, the both tables are related, and share the same key.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I employed the formula you suggested me for one group:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;MinScoreMeasure = MINX ( SUMMARIZE ( Table1, Table1[Country] , "Measure",[number] ), [Measure])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am not sure the meaning of Measure, for this case, should it be MIN?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 13:22:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1314832#M23052</guid>
      <dc:creator>qsong</dc:creator>
      <dc:date>2020-08-21T13:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure: group by min &amp; if condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1314853#M23055</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="181963" data-lia-user-login="qsong" class="lia-mention lia-mention-user"&gt;qsong&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://dax.guide/minx/" target="_blank"&gt;https://dax.guide/minx/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Harsh Nathani&lt;BR /&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 13:28:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1314853#M23055</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-21T13:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure: group by min &amp; if condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1314866#M23058</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So country comes from the TABLE1, while name is from TABLE2. Both tables are related in a common key.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The number is not minimal by country and name, you can see the number is different from&amp;nbsp; min_number which is the result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The formula you suggested me does not work, because syntax is not correct.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 13:31:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1314866#M23058</guid>
      <dc:creator>qsong</dc:creator>
      <dc:date>2020-08-21T13:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure: group by min &amp; if condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1316619#M23132</link>
      <description>&lt;P&gt;Please try this expression in a table visual with the Country and Name columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Min =&lt;BR /&gt;VAR thismin = [number]&lt;BR /&gt;VAR allmin =&lt;BR /&gt;MINX ( ALL ( Table1[Country], Table2[Name] ), [number] )&lt;BR /&gt;RETURN&lt;BR /&gt;IF ( thismin = allmin, 1, 0 )&lt;BR /&gt;&lt;BR /&gt;&lt;/P&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, 22 Aug 2020 21:58:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1316619#M23132</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2020-08-22T21:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Measure: group by min &amp; if condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1316737#M23136</link>
      <description>The table you've shown as first in your question is not possible in Power BI. As far as I know, there is no way for a visual to generate 2 identical rows with different values of a measure. It's not logically possible because if that was the case, you'd have a measure that for the same selection returns different values.</description>
      <pubDate>Sun, 23 Aug 2020 02:07:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Measure-group-by-min-amp-if-condition/m-p/1316737#M23136</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-23T02:07:16Z</dc:date>
    </item>
  </channel>
</rss>

