<?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: Create a measure to get year corresponding to peak sales sum in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-to-get-year-corresponding-to-peak-sales-sum/m-p/2877496#M93006</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Sorry for the mistake.&lt;/P&gt;
&lt;P&gt;Please kindly check the below whether it suits your requirement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Year of max sales sum: =
VAR _maxsales =
    MAXX ( SUMMARIZE ( Table2, Table2[Year], Table2[Sales] ), Table2[Sales] )
VAR _maxsalesyear =
    FILTER (
        SUMMARIZE ( Table2, Table2[Year], Table2[Sales] ),
        Table2[Sales] = _maxsales
    )
RETURN
    IF ( HASONEVALUE ( Table1[Asset] ), MAXX ( _maxsalesyear, Table2[Year] ) )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Nov 2022 14:10:32 GMT</pubDate>
    <dc:creator>Jihwan_Kim</dc:creator>
    <dc:date>2022-11-01T14:10:32Z</dc:date>
    <item>
      <title>Create a measure to get year corresponding to peak sales sum</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-to-get-year-corresponding-to-peak-sales-sum/m-p/2876981#M92984</link>
      <description>&lt;P&gt;We have two input tables and I want to return a grid as shown below. The tables are related based on the Product column via one to many relationship.&amp;nbsp; The year corresponds to the maximum sales sum for an Asset.&lt;/P&gt;&lt;P&gt;Example : for A1 the max sales sum is 90 so the year corresponding to that is 2022&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 10:40:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-to-get-year-corresponding-to-peak-sales-sum/m-p/2876981#M92984</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-01T10:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: Create a measure to get year corresponding to peak sales sum</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-to-get-year-corresponding-to-peak-sales-sum/m-p/2876998#M92985</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;&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;LI-CODE lang="markup"&gt;Year of max sales sum: =
VAR _newtable =
    ADDCOLUMNS (
        DISTINCT ( Table2[Year] ),
        "@salessum", CALCULATE ( SUM ( Table2[Sales] ) )
    )
VAR _maxsales =
    GROUPBY (
        _newtable,
        Table2[Year],
        "@maxsales", MAXX ( CURRENTGROUP (), [@salessum] )
    )
RETURN
    IF ( HASONEVALUE ( Table1[Asset] ), MAXX ( _maxsales, Table2[Year] ) )
&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 01 Nov 2022 10:51:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-to-get-year-corresponding-to-peak-sales-sum/m-p/2876998#M92985</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-11-01T10:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Create a measure to get year corresponding to peak sales sum</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-to-get-year-corresponding-to-peak-sales-sum/m-p/2877381#M92996</link>
      <description>&lt;P&gt;Thanks! But this not render the correct result for A1, it should be 2022&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 13:29:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-to-get-year-corresponding-to-peak-sales-sum/m-p/2877381#M92996</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-01T13:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Create a measure to get year corresponding to peak sales sum</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-to-get-year-corresponding-to-peak-sales-sum/m-p/2877496#M93006</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Sorry for the mistake.&lt;/P&gt;
&lt;P&gt;Please kindly check the below whether it suits your requirement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Year of max sales sum: =
VAR _maxsales =
    MAXX ( SUMMARIZE ( Table2, Table2[Year], Table2[Sales] ), Table2[Sales] )
VAR _maxsalesyear =
    FILTER (
        SUMMARIZE ( Table2, Table2[Year], Table2[Sales] ),
        Table2[Sales] = _maxsales
    )
RETURN
    IF ( HASONEVALUE ( Table1[Asset] ), MAXX ( _maxsalesyear, Table2[Year] ) )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 14:10:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-measure-to-get-year-corresponding-to-peak-sales-sum/m-p/2877496#M93006</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-11-01T14:10:32Z</dc:date>
    </item>
  </channel>
</rss>

