title: Power Query MAX Value from a table
body: <p>I trying to get the MAX date from a table onto a different date with power query. At the moment I'm stuck and all I get is a table based on a condition. Not sure if this is clear, so I'll explain with the code. This is my code at the moment:</p>
  
  <pre><code>let
      Source = Table.NestedJoin(Table.NestedJoin(SKU,{"SKU"},q_UltColh_NEW,{"SKU"},"qUltColh_NEW",JoinKind.LeftOuter),{"SKU"},r_STK,{"SKU"},"Rep_Stk", JoinKind.LeftOuter),
  .
  .
  .
  #"Expanded Origem" = ...
      #"Expanded Origem" = Table.ExpandTableColumn(#"Merged Queries", "Origem", {"Desc_ORI", "Parent_ORI"}, {"Origem.Desc_ORI", "Origem.Parent_ORI"}),
      #"Added Last_Rec" = Table.AddColumn(#"Expanded Origem", "Last_Rec", each 
                                                              let SKU = [SKU]
                                                              in Table.SelectRows(r_GOODSREC,each [SKU]=SKU)
  )
  in
      #"Added Last_Rec"
  </code></pre>
  
  <p>I have two tables:</p>
  
  <pre><code>SKU     Desc
  46_24_  ABC
  103_5_  DEF
  
  doc_DATE    RowNo   SKU     Cod_ART     QTT
  10/01/2017  1       46_24_  46.24       50
  14/01/2017  1       46_24_  46.24       100
  14/01/2017  1       103_5_  103.5       50
  16/01/2017  1       103_5_  103.5       100
  </code></pre>
  
  <p>And I want to get:</p>
  
  <pre><code>SKU     Desc    Last_Entry  Qtt
  46_24_  ABC     14/01/2017  50
  103_5_  DEF     16/01/2017  100
  </code></pre>
  
  <p>my code is returning a table with various columns:
      SKU     Desc    Last_Entry<br>
      46_24_  ABC     Table<br>
      103_5_  DEF     Table   </p>
  
  <p>I believe once I get the max value I can just exapand the table, unless you tell me that is a bad ideia.</p>
  
  <p>Thank you very much,</p>