<?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 to show the max customers count and the corresponding date by grouping of date field in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-show-the-max-customers-count-and-the/m-p/855093#M6810</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="188744" data-lia-user-login="manojsv19" class="lia-mention lia-mention-user"&gt;manojsv19&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Figured out the syntax of a the virtual table so that you don't need to create a calculated column. This replaces the last measure.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Date with highest count of customers 2 = 
VAR _newTable =
    ADDCOLUMNS (
        'Table',
        "Sum of customers per d", CALCULATE (
            SUM ( 'Table'[Customers Count] ),
            ALLEXCEPT ( 'Table', 'Table'[ Date] )
        )
    )
VAR _newTableMax =
    MAXX ( _newTable, [Sum of customers per d] )

var _calc = CALCULATE(MAX('Table'[ Date]),FILTER(_newTable,MAX([Sum of customers per d] )= _newTableMax))

RETURN
    _calc&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Let me know if you have any questions.&lt;BR /&gt;&lt;BR /&gt;If this solves your issues, please mark it as the &lt;STRONG&gt;solution, &lt;/STRONG&gt;so that others can find it easily. &lt;STRONG&gt;Kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;are nice too.&lt;BR /&gt;Nathaniel&lt;/P&gt;</description>
    <pubDate>Sun, 24 Nov 2019 23:22:07 GMT</pubDate>
    <dc:creator>Nathaniel_C</dc:creator>
    <dc:date>2019-11-24T23:22:07Z</dc:date>
    <item>
      <title>DAX measure to show the max customers count and the corresponding date by grouping of date field</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-show-the-max-customers-count-and-the/m-p/855035#M6806</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a requirement to create a DAX measure to calculate to show the max customers count by grouping them on date and to display the corresponding day with max customers count.&amp;nbsp; I am using directy query and not storing any data inside Power BI&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the dummied data table to illustrate my scenario.Here, i wanted to calcualate the sum of customers count by grouping them on Date column, then display the date with maxium customers count and also want to display the max customers count.&lt;/P&gt;&lt;P&gt;I have also provided the table after grouping by date. At the end, i wanted to display the &lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;max customers count (946) and the corresponding date (11/13/2019).&amp;nbsp;&lt;/STRONG&gt; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;&lt;FONT color="#000000"&gt;I would appreciate any suggestions or feedback to get the max customers count and the corresponding date field using DAX measure in Direct Query.&lt;/FONT&gt; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Fact Table&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;Date&lt;/TD&gt;&lt;TD&gt;Customers Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/1/2019&lt;/TD&gt;&lt;TD&gt;230&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/1/2019&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/1/2019&lt;/TD&gt;&lt;TD&gt;245&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/2/2019&lt;/TD&gt;&lt;TD&gt;165&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/2/2019&lt;/TD&gt;&lt;TD&gt;176&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/2/2019&lt;/TD&gt;&lt;TD&gt;185&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/13/2019&lt;/TD&gt;&lt;TD&gt;56&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/13/2019&lt;/TD&gt;&lt;TD&gt;320&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/13/2019&lt;/TD&gt;&lt;TD&gt;120&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/13/2019&lt;/TD&gt;&lt;TD&gt;450&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/24/2019&lt;/TD&gt;&lt;TD&gt;190&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/24/2019&lt;/TD&gt;&lt;TD&gt;120&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/24/2019&lt;/TD&gt;&lt;TD&gt;340&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/24/2019&lt;/TD&gt;&lt;TD&gt;230&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table after grouping the data based on date field&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Customers Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/1/2019&lt;/TD&gt;&lt;TD&gt;625&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/2/2019&lt;/TD&gt;&lt;TD&gt;526&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;11/13/2019&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;946&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/24/2019&lt;/TD&gt;&lt;TD&gt;880&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!!&lt;/P&gt;</description>
      <pubDate>Sun, 24 Nov 2019 18:27:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-show-the-max-customers-count-and-the/m-p/855035#M6806</guid>
      <dc:creator>manojsv19</dc:creator>
      <dc:date>2019-11-24T18:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure to show the max customers count and the corresponding date by grouping of date field</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-show-the-max-customers-count-and-the/m-p/855089#M6809</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="188744" data-lia-user-login="manojsv19" class="lia-mention lia-mention-user"&gt;manojsv19&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;img /&gt;First measure&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Max Count of Customers on one day = 


VAR _newTable =
    ADDCOLUMNS (
        'Table',
        "Sum of customers per d", CALCULATE (
            SUM ( 'Table'[Customers Count] ),
            ALLEXCEPT ( 'Table', 'Table'[ Date] )
        )
    )
VAR _newTableMax =
    MAXX ( _newTable, [Sum of customers per d] )



RETURN
    _newTableMax&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Created a calculated column&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sum of customers per date = CALCULATE(sum('Table'[Customers Count]),ALLEXCEPT('Table','Table'[ Date]))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Last measure&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Date with highest count of customers = 
var _maxCount = MAX('Table'[Sum of customers per date])
return
CALCULATE(MAX('Table'[ Date]),FILTER(ALLEXCEPT('Table','Table'[ Date]),'Table'[Sum of customers per date]=_maxCount))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Let me know if you have any questions.&lt;BR /&gt;&lt;BR /&gt;If this solves your issues, please mark it as the &lt;STRONG&gt;solution, &lt;/STRONG&gt;so that others can find it easily. &lt;STRONG&gt;Kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;are nice too.&lt;BR /&gt;Nathaniel&lt;/P&gt;</description>
      <pubDate>Sun, 24 Nov 2019 23:08:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-show-the-max-customers-count-and-the/m-p/855089#M6809</guid>
      <dc:creator>Nathaniel_C</dc:creator>
      <dc:date>2019-11-24T23:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure to show the max customers count and the corresponding date by grouping of date field</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-show-the-max-customers-count-and-the/m-p/855093#M6810</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="188744" data-lia-user-login="manojsv19" class="lia-mention lia-mention-user"&gt;manojsv19&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Figured out the syntax of a the virtual table so that you don't need to create a calculated column. This replaces the last measure.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Date with highest count of customers 2 = 
VAR _newTable =
    ADDCOLUMNS (
        'Table',
        "Sum of customers per d", CALCULATE (
            SUM ( 'Table'[Customers Count] ),
            ALLEXCEPT ( 'Table', 'Table'[ Date] )
        )
    )
VAR _newTableMax =
    MAXX ( _newTable, [Sum of customers per d] )

var _calc = CALCULATE(MAX('Table'[ Date]),FILTER(_newTable,MAX([Sum of customers per d] )= _newTableMax))

RETURN
    _calc&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Let me know if you have any questions.&lt;BR /&gt;&lt;BR /&gt;If this solves your issues, please mark it as the &lt;STRONG&gt;solution, &lt;/STRONG&gt;so that others can find it easily. &lt;STRONG&gt;Kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;are nice too.&lt;BR /&gt;Nathaniel&lt;/P&gt;</description>
      <pubDate>Sun, 24 Nov 2019 23:22:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-show-the-max-customers-count-and-the/m-p/855093#M6810</guid>
      <dc:creator>Nathaniel_C</dc:creator>
      <dc:date>2019-11-24T23:22:07Z</dc:date>
    </item>
  </channel>
</rss>

