<?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: How to get the top 1 value based on date range in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-top-1-value-based-on-date-range/m-p/2863061#M92236</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="405462" data-lia-user-login="gabrieldkvl" class="lia-mention lia-mention-user"&gt;gabrieldkvl&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;First, you never put table name in front of a measure and there's a very good reason not to do so. Please follow the sacred tradition of DAX developers.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, you want to return text, not a number (are you aware of that?). Third, to do what you want you should use the TOPN function and/or ADDCOLUMNS. In the latter case you should then filter for the highest value of the measure and use CONCATENATE(X) on the row(s) returned. There can be more than 1 row returned with the highest value, hence CONCATENATEX.&lt;/P&gt;</description>
    <pubDate>Wed, 26 Oct 2022 01:27:05 GMT</pubDate>
    <dc:creator>daXtreme</dc:creator>
    <dc:date>2022-10-26T01:27:05Z</dc:date>
    <item>
      <title>How to get the top 1 value based on date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-top-1-value-based-on-date-range/m-p/2860638#M92110</link>
      <description>&lt;P&gt;Hello everyone!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a date range between 2017 and 2022. I would like to now what month and year the higher value happened.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had to divide the values to get an average based on USD and m3.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;USD/m³ = CALCULATE (
    SUM ( 'Base 02'[Reached] ),
    'Base 02'[KPI] = "USD"
)
    / CALCULATE (
    SUM ( 'Base 02'[Reached] ),
    'Base 02'[KPI] = "m³"
) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Then I created another measure to get the MAX of USD/m3 ignoring the month and year filters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MAX USD/m³ = 
VAR SelectedMax =
    CALCULATE (
        MAXX (
            VALUES ( 'Base 02'[Year and Month] ),
            'Calculations Base 02'[USD/m³] 
        ),
        ALLSELECTED ( 'Base 02'[Year and Month] )
    )
RETURN
    SelectedMax&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The result was successfully displayed. But I don't know how to add the year and month when this value happened.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The currently result is: 1.265.03&lt;/P&gt;&lt;P&gt;I would like something like: 1.265.03&amp;nbsp; Mar/2020&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My year and month table contains the right format of date and it contains a typical hierarchy of calendar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 05:13:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-top-1-value-based-on-date-range/m-p/2860638#M92110</guid>
      <dc:creator>gabrieldkvl</dc:creator>
      <dc:date>2022-10-25T05:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the top 1 value based on date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-top-1-value-based-on-date-range/m-p/2863061#M92236</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="405462" data-lia-user-login="gabrieldkvl" class="lia-mention lia-mention-user"&gt;gabrieldkvl&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;First, you never put table name in front of a measure and there's a very good reason not to do so. Please follow the sacred tradition of DAX developers.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, you want to return text, not a number (are you aware of that?). Third, to do what you want you should use the TOPN function and/or ADDCOLUMNS. In the latter case you should then filter for the highest value of the measure and use CONCATENATE(X) on the row(s) returned. There can be more than 1 row returned with the highest value, hence CONCATENATEX.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 01:27:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-top-1-value-based-on-date-range/m-p/2863061#M92236</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-10-26T01:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the top 1 value based on date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-top-1-value-based-on-date-range/m-p/2873570#M92814</link>
      <description>&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="405462" data-lia-user-login="gabrieldkvl" class="lia-mention lia-mention-user"&gt;gabrieldkvl&lt;/a&gt;,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;&lt;A href="http://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;How to Get Your Question Answered Quickly&amp;nbsp;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Xiaoxin Sheng&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2022 02:31:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-the-top-1-value-based-on-date-range/m-p/2873570#M92814</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-10-31T02:31:20Z</dc:date>
    </item>
  </channel>
</rss>

