<?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: Extract the whole line of a table containing the maximum value in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-the-whole-line-of-a-table-containing-the-maximum-value/m-p/4329199#M171851</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="879384" data-lia-user-login="Toine40" class="lia-mention lia-mention-user"&gt;Toine40&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To get the maximum stop cause and its corresponding duration, you can achieve this either by creating a dynamic measure or by defining a calculated table, depending on your needs.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;For a dynamic solution without creating a new table, you can write a measure that identifies the maximum stop duration and retrieves the associated stop cause. The measure can be defined as follows:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Max_Stop_Cause = 
VAR MaxDuration = 
    MAXX(
        FILTER(
            'Arrêts',
            'Arrêts'[Type d'arrêt] IN {"ARE", "AI", "ANQ"} &amp;amp;&amp;amp;
            'Arrêts'[Atelier] = "U2_M_DECOUPE"
        ),
        'Arrêts'[Temps (en min)]
    )
VAR MaxRow =
    TOPN(
        1,
        FILTER(
            'Arrêts',
            'Arrêts'[Type d'arrêt] IN {"ARE", "AI", "ANQ"} &amp;amp;&amp;amp;
            'Arrêts'[Atelier] = "U2_M_DECOUPE"
        ),
        'Arrêts'[Temps (en min)],
        DESC
    )
RETURN
    CONCATENATEX(
        MaxRow,
        'Arrêts'[Libellé Motif] &amp;amp; " - " &amp;amp; MaxDuration,
        ", "
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;This measure dynamically calculates the maximum stop duration by filtering the relevant rows and creates a string combining the stop cause and the maximum duration.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 14 Dec 2024 11:56:04 GMT</pubDate>
    <dc:creator>DataNinja777</dc:creator>
    <dc:date>2024-12-14T11:56:04Z</dc:date>
    <item>
      <title>Extract the whole line of a table containing the maximum value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-the-whole-line-of-a-table-containing-the-maximum-value/m-p/4329153#M171850</link>
      <description>&lt;P&gt;Hi everyone,&amp;nbsp;&lt;BR /&gt;I have this table, in which each line represents a stop cause and the duration of each stop :&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I manage to create a table to sum the stop duration and group by stop cause with this formula :&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;Tab_Cause_Arret_maxi =&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;SUMMARIZECOLUMNS&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;'Arrêts'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'Arrêts'&lt;/SPA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;&lt;FONT color="#000000"&gt;Here's the result :&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;What I would like now is to get only the first line, corresponding to the maximum stop cause&amp;nbsp;&lt;BR /&gt;I manage to get the max stop duration with this formula :&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;CAUSE MAX =&lt;/SPAN&gt; &lt;SPAN&gt;MAXX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Tab_Cause_Arret_maxi&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;Tab_Cause_Arret_maxi&lt;/SPAN&gt;&lt;SPAN&gt;[Tps_maxi]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;But what I want is the whole line, sth like this, with the stopo cause and the duration :&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Can someone help ?&lt;BR /&gt;And maybe there's a way to get the result without creating this new table ?&lt;BR /&gt;&lt;BR /&gt;Thanks to all of you&lt;/P&gt;</description>
      <pubDate>Sat, 14 Dec 2024 11:00:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-the-whole-line-of-a-table-containing-the-maximum-value/m-p/4329153#M171850</guid>
      <dc:creator>Toine40</dc:creator>
      <dc:date>2024-12-14T11:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Extract the whole line of a table containing the maximum value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-the-whole-line-of-a-table-containing-the-maximum-value/m-p/4329199#M171851</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="879384" data-lia-user-login="Toine40" class="lia-mention lia-mention-user"&gt;Toine40&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To get the maximum stop cause and its corresponding duration, you can achieve this either by creating a dynamic measure or by defining a calculated table, depending on your needs.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;For a dynamic solution without creating a new table, you can write a measure that identifies the maximum stop duration and retrieves the associated stop cause. The measure can be defined as follows:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Max_Stop_Cause = 
VAR MaxDuration = 
    MAXX(
        FILTER(
            'Arrêts',
            'Arrêts'[Type d'arrêt] IN {"ARE", "AI", "ANQ"} &amp;amp;&amp;amp;
            'Arrêts'[Atelier] = "U2_M_DECOUPE"
        ),
        'Arrêts'[Temps (en min)]
    )
VAR MaxRow =
    TOPN(
        1,
        FILTER(
            'Arrêts',
            'Arrêts'[Type d'arrêt] IN {"ARE", "AI", "ANQ"} &amp;amp;&amp;amp;
            'Arrêts'[Atelier] = "U2_M_DECOUPE"
        ),
        'Arrêts'[Temps (en min)],
        DESC
    )
RETURN
    CONCATENATEX(
        MaxRow,
        'Arrêts'[Libellé Motif] &amp;amp; " - " &amp;amp; MaxDuration,
        ", "
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;This measure dynamically calculates the maximum stop duration by filtering the relevant rows and creates a string combining the stop cause and the maximum duration.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Dec 2024 11:56:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-the-whole-line-of-a-table-containing-the-maximum-value/m-p/4329199#M171851</guid>
      <dc:creator>DataNinja777</dc:creator>
      <dc:date>2024-12-14T11:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: Extract the whole line of a table containing the maximum value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-the-whole-line-of-a-table-containing-the-maximum-value/m-p/4329255#M171852</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="608865" data-lia-user-login="DataNinja777" class="lia-mention lia-mention-user"&gt;DataNinja777&lt;/a&gt;,&lt;BR /&gt;This looks so great, that's exactly what I need ! Only thing is the result is&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;This is the second max cause and not the first one ; I've been trying to understand for more thant 1 hour but can't find the reason&lt;/P&gt;</description>
      <pubDate>Sat, 14 Dec 2024 14:09:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-the-whole-line-of-a-table-containing-the-maximum-value/m-p/4329255#M171852</guid>
      <dc:creator>Toine40</dc:creator>
      <dc:date>2024-12-14T14:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Extract the whole line of a table containing the maximum value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-the-whole-line-of-a-table-containing-the-maximum-value/m-p/4330014#M171882</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="879384" data-lia-user-login="Toine40" class="lia-mention lia-mention-user"&gt;Toine40&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try this measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;MEASURE =
CONCATENATEX (
    TOPN ( 1, 'Tab_Cause_Arret_maxi', 'Tab_Cause_Arret_maxi'[Tps_maxi], 0 ),
    'Tab_Cause_Arret_maxi'[Libellé Motif] &amp;amp; " " &amp;amp; 'Tab_Cause_Arret_maxi'[Tps_maxi]
)
&lt;/LI-CODE&gt;
&lt;P&gt;the result is as follow:&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;Best Regards&lt;/P&gt;
&lt;P&gt;Zhengdong Xu&lt;BR /&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 03:20:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-the-whole-line-of-a-table-containing-the-maximum-value/m-p/4330014#M171882</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-16T03:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: Extract the whole line of a table containing the maximum value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-the-whole-line-of-a-table-containing-the-maximum-value/m-p/4331565#M171960</link>
      <description>&lt;P&gt;Thks a lot&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;v-zhengdxu-msft,&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;This works fine !!! I'd like we could mix both your answer and the one of DataNinja777 to avoid the creation of a new table, but if we can't you solution is th best. Thanks a lot for this&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 16 Dec 2024 21:16:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-the-whole-line-of-a-table-containing-the-maximum-value/m-p/4331565#M171960</guid>
      <dc:creator>Toine40</dc:creator>
      <dc:date>2024-12-16T21:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: Extract the whole line of a table containing the maximum value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-the-whole-line-of-a-table-containing-the-maximum-value/m-p/4331927#M171979</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="879384" data-lia-user-login="Toine40" class="lia-mention lia-mention-user"&gt;Toine40&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try this measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;MEASURE =
VAR _Tab_Cause_Arret_maxi =
    SUMMARIZECOLUMNS (
        'Arrêts'[Date],
        'Arrêts'[Libellé Motif],
        FILTER (
            'Arrêts',
            'Arrêts'[Type d'arrêt]
                IN { "ARE", "AI", "ANQ" }
                    &amp;amp;&amp;amp; 'Arrêts'[Atelier] = "U2_M_DECOUPE"
        ),
        "Tps_maxi", SUM ( 'Arrêts'[Temps (en min)] )
    )
RETURN
    CONCATENATEX (
        TOPN ( 1, _Tab_Cause_Arret_maxi, [Tps_maxi], 0 ),
        [Libellé Motif] &amp;amp; " " &amp;amp; [Tps_maxi]
    )&lt;/LI-CODE&gt;
&lt;P&gt;This measure creates a virtual table variable, so that you don't need to create an entity table anymore.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Zhengdong Xu&lt;BR /&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 02:19:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-the-whole-line-of-a-table-containing-the-maximum-value/m-p/4331927#M171979</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-17T02:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: Extract the whole line of a table containing the maximum value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-the-whole-line-of-a-table-containing-the-maximum-value/m-p/4334612#M172097</link>
      <description>&lt;P&gt;This is it !!!! Exactly ! Thank you so much&amp;nbsp;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;@&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;v-zhengdxu-msft &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 07:53:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Extract-the-whole-line-of-a-table-containing-the-maximum-value/m-p/4334612#M172097</guid>
      <dc:creator>Toine40</dc:creator>
      <dc:date>2024-12-18T07:53:22Z</dc:date>
    </item>
  </channel>
</rss>

