<?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: Most common value from a measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Most-common-value-from-a-measure/m-p/2192405#M51281</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.&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;STRONG&gt;&lt;EM&gt;The most common value from Column B: =&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;EM&gt;VAR groupby_columnB =&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;GROUPBY ( Data, Data[B], "@count_rows", SUMX ( CURRENTGROUP (), 1 ) )&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;VAR max_countrows =&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;MAXX ( groupby_columnB, [@count_rows] )&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;RETURN&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;MAXX ( FILTER ( groupby_columnB, [@count_rows] = max_countrows ), Data[B] )&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Nov 2021 12:38:17 GMT</pubDate>
    <dc:creator>Jihwan_Kim</dc:creator>
    <dc:date>2021-11-16T12:38:17Z</dc:date>
    <item>
      <title>Most common value from a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Most-common-value-from-a-measure/m-p/2190861#M51224</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Say I have a table with two number columns (A and B).&lt;/P&gt;&lt;P&gt;I have created a measure (not a calculated column) (C) that calculates the differense between the columns (A - B)&lt;/P&gt;&lt;P&gt;A B C&lt;BR /&gt;5 3 2&lt;BR /&gt;7 2 5&lt;BR /&gt;6 4 2&lt;BR /&gt;4 2 2&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Now I would like to show the most common value (which in this case is 2) in a card viz based on the measure I've created.&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I create such a measure?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 18:46:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Most-common-value-from-a-measure/m-p/2190861#M51224</guid>
      <dc:creator>Clay82</dc:creator>
      <dc:date>2021-11-15T18:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: Most common value from a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Most-common-value-from-a-measure/m-p/2190905#M51227</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&lt;/P&gt;
&lt;P&gt;All measures are in the attached pbix file.&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;DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;&lt;EM&gt;The most common value: = &lt;/EM&gt;&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;VAR add_measureC =&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;ADDCOLUMNS ( Data, "@measureC", [C:] )&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;VAR groupby_measureC =&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;GROUPBY (&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;add_measureC,&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;[@measureC],&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;"@count_rows", SUMX ( CURRENTGROUP (), 1 )&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt; )&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;VAR max_countrows =&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;MAXX ( groupby_measureC, [@count_rows] )&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;RETURN&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;MAXX ( FILTER ( groupby_measureC, [@count_rows] = max_countrows ), [@measureC] )&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 15 Nov 2021 19:15:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Most-common-value-from-a-measure/m-p/2190905#M51227</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2021-11-15T19:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: Most common value from a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Most-common-value-from-a-measure/m-p/2190926#M51230</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="300390" data-lia-user-login="Clay82" class="lia-mention lia-mention-user"&gt;Clay82&lt;/a&gt;&amp;nbsp; you can achieve the end goal with thfollowing measure&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;_diff = SUM(tbl[A])-SUM(tbl[B])

Measure =
VAR _1 =
    ADDCOLUMNS ( tbl, "diff", [_diff] )
VAR _2 =
    ADDCOLUMNS (
        _1,
        "count", COUNTX ( FILTER ( _1, EARLIER ( [diff] ) = [diff] ), [diff] )
    )
VAR _3 =
    ADDCOLUMNS (
        _2,
        "rank", RANKX ( FILTER ( _2, EARLIER ( [count] ) &amp;lt; [count] ), [count],, DESC, DENSE )
    )
RETURN
    MAXX ( FILTER ( _3, [rank] = 1 ), [diff] )
&lt;/LI-CODE&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 19:24:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Most-common-value-from-a-measure/m-p/2190926#M51230</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2021-11-15T19:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Most common value from a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Most-common-value-from-a-measure/m-p/2191575#M51252</link>
      <description>&lt;P&gt;Simple enough by Excel worksheet formula.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 04:02:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Most-common-value-from-a-measure/m-p/2191575#M51252</guid>
      <dc:creator>CNENFRNL</dc:creator>
      <dc:date>2021-11-16T04:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: Most common value from a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Most-common-value-from-a-measure/m-p/2191712#M51257</link>
      <description>&lt;P&gt;Wow Jihwan it worked perfectly! Thank you!&lt;/P&gt;&lt;P&gt;Also I need the same for column B (which is in fact a measure based on a calculated column. So another measure to find the most common value in column B. Is it possible for you to help me?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 05:48:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Most-common-value-from-a-measure/m-p/2191712#M51257</guid>
      <dc:creator>Clay82</dc:creator>
      <dc:date>2021-11-16T05:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: Most common value from a measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Most-common-value-from-a-measure/m-p/2192405#M51281</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.&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;STRONG&gt;&lt;EM&gt;The most common value from Column B: =&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;EM&gt;VAR groupby_columnB =&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;GROUPBY ( Data, Data[B], "@count_rows", SUMX ( CURRENTGROUP (), 1 ) )&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;VAR max_countrows =&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;MAXX ( groupby_columnB, [@count_rows] )&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;RETURN&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;MAXX ( FILTER ( groupby_columnB, [@count_rows] = max_countrows ), Data[B] )&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 12:38:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Most-common-value-from-a-measure/m-p/2192405#M51281</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2021-11-16T12:38:17Z</dc:date>
    </item>
  </channel>
</rss>

