<?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: LOOKUPVALUE - Return a value closest to a date in another table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOOKUPVALUE-Return-a-value-closest-to-a-date-in-another-table/m-p/1860550#M39855</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Add the following column to the Growth Table:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Closest Bio Age= 
var __player = Sprint[Player ID]
var __sprdate = Sprint[Session Date] 
var __growth = 
    ADDCOLUMNS(
        FILTER(
            Growth,
            Growth[Player ID] = __player
        ),
        "diff", ABS(DATEDIFF(__sprdate , Growth[Session Date] , DAY ))
    )
var __mindiff = MINX( __growth,[diff])

var __age =     
    MAXX(
        FILTER( __growth, [diff]  = __mindiff ),
        Growth[Bio Age]
    )
return
    __age       
        &lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 24 May 2021 15:08:04 GMT</pubDate>
    <dc:creator>Fowmy</dc:creator>
    <dc:date>2021-05-24T15:08:04Z</dc:date>
    <item>
      <title>LOOKUPVALUE - Return a value closest to a date in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOOKUPVALUE-Return-a-value-closest-to-a-date-in-another-table/m-p/1860510#M39853</link>
      <description>&lt;P&gt;Hi There,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Aim:&lt;/STRONG&gt; Create a Calculated Column that returns the value closest to the test date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a 'Growth' table (Table 1) and a 'Sprint' table (Table 2). The growth table contains the a Bio Age value. I would like to append Bio Age into the Sprint table in order to figure out what a player's Bio Age was at the time they took a sprint test. A player could have undertake a sprint test at a different time to getting their measurements taken (which are stored in the Growth table). Therefore, I need to find the &lt;U&gt;Bio Age of a player that has been recorded closest to the session date that the sprint test&lt;/U&gt; was undertaken.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Relationship:&lt;/STRONG&gt; There is no relationship between the two tables as there are duplicate values within the two - which is why I thought LOOKUPVALUE may be the best method of finding the value. PlayerID is present in both tables.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;U&gt;&lt;STRONG&gt;Table 1 - Growth:&lt;/STRONG&gt;&lt;/U&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Player ID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Session Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Height (cm)&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;Bio Age&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;001&lt;/TD&gt;&lt;TD&gt;01/04/2019&lt;/TD&gt;&lt;TD&gt;130.7&lt;/TD&gt;&lt;TD&gt;8.8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;001&lt;/TD&gt;&lt;TD&gt;18/06/2020&lt;/TD&gt;&lt;TD&gt;133.7&lt;/TD&gt;&lt;TD&gt;9.3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;001&lt;/TD&gt;&lt;TD&gt;09/03/2021&lt;/TD&gt;&lt;TD&gt;134.9&lt;/TD&gt;&lt;TD&gt;9.7&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;&lt;BR /&gt;Table 2 - Sprint:&amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Player ID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Session Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Sprint Time - 5m&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Bio Age&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;001&lt;/TD&gt;&lt;TD&gt;01/05/2019&lt;/TD&gt;&lt;TD&gt;3.21&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;?&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;001&lt;/TD&gt;&lt;TD&gt;10/05/2020&lt;/TD&gt;&lt;TD&gt;3.18&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;?&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;001&lt;/TD&gt;&lt;TD&gt;24/05/2021&lt;/TD&gt;&lt;TD&gt;3.17&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;?&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciate. Many thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 May 2021 14:37:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOOKUPVALUE-Return-a-value-closest-to-a-date-in-another-table/m-p/1860510#M39853</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-05-24T14:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: LOOKUPVALUE - Return a value closest to a date in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOOKUPVALUE-Return-a-value-closest-to-a-date-in-another-table/m-p/1860550#M39855</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Add the following column to the Growth Table:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Closest Bio Age= 
var __player = Sprint[Player ID]
var __sprdate = Sprint[Session Date] 
var __growth = 
    ADDCOLUMNS(
        FILTER(
            Growth,
            Growth[Player ID] = __player
        ),
        "diff", ABS(DATEDIFF(__sprdate , Growth[Session Date] , DAY ))
    )
var __mindiff = MINX( __growth,[diff])

var __age =     
    MAXX(
        FILTER( __growth, [diff]  = __mindiff ),
        Growth[Bio Age]
    )
return
    __age       
        &lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 24 May 2021 15:08:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOOKUPVALUE-Return-a-value-closest-to-a-date-in-another-table/m-p/1860550#M39855</guid>
      <dc:creator>Fowmy</dc:creator>
      <dc:date>2021-05-24T15:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: LOOKUPVALUE - Return a value closest to a date in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOOKUPVALUE-Return-a-value-closest-to-a-date-in-another-table/m-p/1860645#M39857</link>
      <description>&lt;P&gt;So far so good! You my friend are a dream!&lt;BR /&gt;&lt;BR /&gt;Thank you so much for your input&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 May 2021 15:45:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOOKUPVALUE-Return-a-value-closest-to-a-date-in-another-table/m-p/1860645#M39857</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-05-24T15:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: LOOKUPVALUE - Return a value closest to a date in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOOKUPVALUE-Return-a-value-closest-to-a-date-in-another-table/m-p/2848729#M91227</link>
      <description>&lt;P&gt;How would you&amp;nbsp; change the code if Player ID didnt exist?? and session date was just a numerical field and you had to look up and return the Bio Age based on the closest value to the numerical field?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 09:39:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LOOKUPVALUE-Return-a-value-closest-to-a-date-in-another-table/m-p/2848729#M91227</guid>
      <dc:creator>fingalbrad</dc:creator>
      <dc:date>2022-10-18T09:39:54Z</dc:date>
    </item>
  </channel>
</rss>

