<?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 Get First Value From A Column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-First-Value-From-A-Column/m-p/4267304#M169170</link>
    <description>&lt;P&gt;Hi have a table called "StockQuotes" that looks like this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I wrote the following code as an attempt to fetch the &lt;U&gt;first available (from the earliest date) &lt;STRONG&gt;Close Price&lt;/STRONG&gt; for each respective stock ticker&lt;/U&gt;:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;First Close = 
  VAR Ticker = SELECTEDVALUE( StockQuotes[Ticker] )
  VAR Result = MINX (
    TOPN (
        1,
        FILTER ( StockQuotes, StockQuotes[Ticker] = Ticker ),
        StockQuotes[Date], ASC
    ),
    StockQuotes[Close Price]
)
RETURN
  Result&lt;/LI-CODE&gt;&lt;P&gt;I then created the matrix visual below with the dates along the rows and stock tickers across the top to check whether the above code produced the desired results:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;But as it can be seen the code it's not working since I was expecting the matrix to return repeated numbers under the &lt;STRONG&gt;First Close&lt;/STRONG&gt; column for each respective ticker (&lt;U&gt;i.e.:&lt;/U&gt; $63.96 for AAPL, $89.57 for AMZN, $323,400.00 for BRK-A, $63.69 for GOOG and so on...), not a mirror image of the Close Price column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I missing here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help on getting to the right code is greatly apreciated!&lt;/P&gt;</description>
    <pubDate>Fri, 01 Nov 2024 18:11:31 GMT</pubDate>
    <dc:creator>leolapa_br</dc:creator>
    <dc:date>2024-11-01T18:11:31Z</dc:date>
    <item>
      <title>Get First Value From A Column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-First-Value-From-A-Column/m-p/4267304#M169170</link>
      <description>&lt;P&gt;Hi have a table called "StockQuotes" that looks like this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I wrote the following code as an attempt to fetch the &lt;U&gt;first available (from the earliest date) &lt;STRONG&gt;Close Price&lt;/STRONG&gt; for each respective stock ticker&lt;/U&gt;:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;First Close = 
  VAR Ticker = SELECTEDVALUE( StockQuotes[Ticker] )
  VAR Result = MINX (
    TOPN (
        1,
        FILTER ( StockQuotes, StockQuotes[Ticker] = Ticker ),
        StockQuotes[Date], ASC
    ),
    StockQuotes[Close Price]
)
RETURN
  Result&lt;/LI-CODE&gt;&lt;P&gt;I then created the matrix visual below with the dates along the rows and stock tickers across the top to check whether the above code produced the desired results:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;But as it can be seen the code it's not working since I was expecting the matrix to return repeated numbers under the &lt;STRONG&gt;First Close&lt;/STRONG&gt; column for each respective ticker (&lt;U&gt;i.e.:&lt;/U&gt; $63.96 for AAPL, $89.57 for AMZN, $323,400.00 for BRK-A, $63.69 for GOOG and so on...), not a mirror image of the Close Price column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I missing here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help on getting to the right code is greatly apreciated!&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 18:11:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-First-Value-From-A-Column/m-p/4267304#M169170</guid>
      <dc:creator>leolapa_br</dc:creator>
      <dc:date>2024-11-01T18:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: Get First Value From A Column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-First-Value-From-A-Column/m-p/4267323#M169174</link>
      <description>&lt;P&gt;ChatGTP came to the rescue here and produced the following code that solved the issue:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;First Close = 
CALCULATE(
    FIRSTNONBLANK(StockQuotes[Close Price], 1),
    FILTER(
        ALL(StockQuotes),
        StockQuotes[Ticker] = SELECTEDVALUE(StockQuotes[Ticker]) &amp;amp;&amp;amp;
        StockQuotes[Date] = 
            CALCULATE(
                MIN(StockQuotes[Date]),
                ALLEXCEPT(StockQuotes, StockQuotes[Ticker])
            )
    )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 01 Nov 2024 18:46:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-First-Value-From-A-Column/m-p/4267323#M169174</guid>
      <dc:creator>leolapa_br</dc:creator>
      <dc:date>2024-11-01T18:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Get First Value From A Column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-First-Value-From-A-Column/m-p/4268271#M169229</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="604138" data-lia-user-login="leolapa_br" class="lia-mention lia-mention-user"&gt;leolapa_br&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for sharing, this will help other users who have the same question.&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;Mengmeng Li&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 01:19:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-First-Value-From-A-Column/m-p/4268271#M169229</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-04T01:19:47Z</dc:date>
    </item>
  </channel>
</rss>

