<?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: Measure value for first item only in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-value-for-first-item-only/m-p/3456245#M131750</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;I mean the first row/occurence of a given Order No&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DAX has no concept of that "first occurrence"&amp;nbsp; - you need to bring your own index column (or other logic), same like I showed for Power Query.&lt;/P&gt;</description>
    <pubDate>Mon, 02 Oct 2023 15:35:11 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2023-10-02T15:35:11Z</dc:date>
    <item>
      <title>Measure value for first item only</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-value-for-first-item-only/m-p/3454701#M131669</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to create a&amp;nbsp; measure that returns value for the first row with a given order.&lt;/P&gt;&lt;P&gt;The source data is as follows:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;SOURCE DATA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Order No&lt;/TD&gt;&lt;TD&gt;DN#&lt;/TD&gt;&lt;TD&gt;Order Total Weight&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1383130672&lt;/TD&gt;&lt;TD&gt;MK0Q3LL/A&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;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TD&gt;38&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;QAD5540852&lt;/TD&gt;&lt;TD&gt;MGPH3LL/A&lt;/TD&gt;&lt;TD&gt;25&lt;/TD&gt;&lt;TD&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Total Weight column is simply =MAX([Order Total Weight]). How can I get values as shown in column Order Total Weight?&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 19:19:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-value-for-first-item-only/m-p/3454701#M131669</guid>
      <dc:creator>IgorM</dc:creator>
      <dc:date>2023-09-30T19:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: Measure value for first item only</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-value-for-first-item-only/m-p/3455198#M131694</link>
      <description>&lt;P&gt;Please define "First Row" - there is no built-in concept for that in Power Query. Do you mean sorted by DN#?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fc1BCoMwEIXhu8xa6GQmMyZLabEFEzALLSK5/zWqllio4u7Bx8+bZzDs2DBqTVBB7DBxCLdm2YKQq6MPlx6n6z5O7z9PzUPIe63t6s8+FLfuxGPbnbj1anjzPmFxQ7sLMimunnTg8b45/3qx6IS+/6/Sk0DOHw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Order No" = _t, #"DN#" = _t, #"Order Total Weight" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Order Total Weight", Int64.Type}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Order Total Weight", "Total Weight"}}),
    #"Added Index" = Table.AddIndexColumn(#"Renamed Columns", "Index", 0, 1, Int64.Type),
    #"Added Custom" = Table.AddColumn(#"Added Index", "Order Total weight", each if [Index]&amp;gt;0 and #"Added Index"[Order No]{[Index]-1}=[Order No] then null else [Total Weight]),
    #"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Order No", "DN#", "Total Weight", "Order Total weight"})
in
    #"Removed Other Columns"&lt;/LI-CODE&gt;
&lt;P&gt;How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2023 22:00:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-value-for-first-item-only/m-p/3455198#M131694</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-10-01T22:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: Measure value for first item only</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-value-for-first-item-only/m-p/3456007#M131740</link>
      <description>&lt;P&gt;Hi Ibendlin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for a prompt response.&lt;/P&gt;&lt;P&gt;However, what I was actually looking for a DAX solution, not Power Query.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding your question about "first row", please note that by "first row" I mean the first row/occurence of a given Order No. In an Excel pivot table, when you place an item in the Rows section, Excel (by default) does not repeat the item labels when data for a given item is displayed in more than one row.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to replicate exactly the same concept, but for an item placed in the Values section (show the item's value only in the first row with data for that item). I hope I have made myself clear now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;IM&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 13:37:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-value-for-first-item-only/m-p/3456007#M131740</guid>
      <dc:creator>IgorM</dc:creator>
      <dc:date>2023-10-02T13:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Measure value for first item only</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-value-for-first-item-only/m-p/3456245#M131750</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;I mean the first row/occurence of a given Order No&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DAX has no concept of that "first occurrence"&amp;nbsp; - you need to bring your own index column (or other logic), same like I showed for Power Query.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 15:35:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-value-for-first-item-only/m-p/3456245#M131750</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-10-02T15:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: Measure value for first item only</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-value-for-first-item-only/m-p/3466349#M132301</link>
      <description>&lt;P&gt;Hi &lt;SPAN&gt;Ibendlin,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I realise that DAX has no concept of row ordering but for the purpose of this query to identify the first row for a given Order No I was thinking of using the RANK function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Mon, 09 Oct 2023 07:55:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-value-for-first-item-only/m-p/3466349#M132301</guid>
      <dc:creator>IgorM</dc:creator>
      <dc:date>2023-10-09T07:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: Measure value for first item only</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-value-for-first-item-only/m-p/3466733#M132326</link>
      <description>&lt;P&gt;There is also a ROWNUMBER function but the same caveat applies - it is non-deterministic.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Oct 2023 12:14:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-value-for-first-item-only/m-p/3466733#M132326</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-10-09T12:14:22Z</dc:date>
    </item>
  </channel>
</rss>

