<?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 DAX: Combinding lookupvalue with first non blank in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Combinding-lookupvalue-with-first-non-blank/m-p/1979377#M43618</link>
    <description>&lt;P&gt;Hi, i created a calculated column that returns the latest activity type by date. The issue that i am having is that sometimes there are multiple activity types on the same date. When this happens the lookupvalue formula returns nothing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What i would like the formula to do is to return the first or last activity (doesnt matter which) just so that something is being populated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;Latest Activity Date2 = &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR Current_ID = AccountAddressCollection[Account.UUID]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR Max_Date = CALCULATE(MAX(MergedActivities[StartDateTime]), FILTER(MergedActivities,MergedActivities[AccountUUID]= Current_ID))&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LOOKUPVALUE(MergedActivities[Type],MergedActivities[AccountUUID],AccountAddressCollection[Account.UUID],MergedActivities[StartDateTime], Max_Date,"")&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 26 Jul 2021 12:33:49 GMT</pubDate>
    <dc:creator>adam_mac</dc:creator>
    <dc:date>2021-07-26T12:33:49Z</dc:date>
    <item>
      <title>DAX: Combinding lookupvalue with first non blank</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Combinding-lookupvalue-with-first-non-blank/m-p/1979377#M43618</link>
      <description>&lt;P&gt;Hi, i created a calculated column that returns the latest activity type by date. The issue that i am having is that sometimes there are multiple activity types on the same date. When this happens the lookupvalue formula returns nothing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What i would like the formula to do is to return the first or last activity (doesnt matter which) just so that something is being populated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;Latest Activity Date2 = &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR Current_ID = AccountAddressCollection[Account.UUID]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR Max_Date = CALCULATE(MAX(MergedActivities[StartDateTime]), FILTER(MergedActivities,MergedActivities[AccountUUID]= Current_ID))&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LOOKUPVALUE(MergedActivities[Type],MergedActivities[AccountUUID],AccountAddressCollection[Account.UUID],MergedActivities[StartDateTime], Max_Date,"")&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 12:33:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Combinding-lookupvalue-with-first-non-blank/m-p/1979377#M43618</guid>
      <dc:creator>adam_mac</dc:creator>
      <dc:date>2021-07-26T12:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: DAX: Combinding lookupvalue with first non blank</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Combinding-lookupvalue-with-first-non-blank/m-p/1979425#M43619</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="273608" data-lia-user-login="adam_mac" class="lia-mention lia-mention-user"&gt;adam_mac&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you could as alternate result for the LOOKUPVALUE function (last argument) return the MAX or MIN Type for that combination with the following CALCULATE:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CALCULATE(
    MAX( MergedActivities[Type] ),
    MergedActivities[StartDateTime] = Max_Date &amp;amp;&amp;amp; MergedActivities[Account.UUID] = Current_ID
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the measure could look like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Latest Activity Date2 =
VAR Current_ID = AccountAddressCollection[Account.UUID]
VAR Max_Date =
    CALCULATE(
        MAX( MergedActivities[StartDateTime] ),
        FILTER(
            MergedActivities,
            MergedActivities[AccountUUID] = Current_ID
        )
    )
VAR Alternate_Result =
    CALCULATE(
        MAX( MergedActivities[Type] ),
        MergedActivities[StartDateTime] = Max_Date
            &amp;amp;&amp;amp; MergedActivities[Account.UUID] = Current_ID
    )
RETURN
    LOOKUPVALUE(
        MergedActivities[Type],
        MergedActivities[AccountUUID], AccountAddressCollection[Account.UUID],
        MergedActivities[StartDateTime], Max_Date,
        Alternate_Result
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;If you need any help please let me know.&lt;/DIV&gt;&lt;DIV&gt;If I answered your question I would be happy if you could mark my post as a solution &lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt; and give it a thumbs up &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Best regards&lt;/DIV&gt;&lt;DIV&gt;Denis&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Blog: &lt;A title="Click here!" href="https://whatthefact.bi/?utm_source=powerbicommunity&amp;amp;utm_medium=link&amp;amp;utm_campaign=forum" target="_blank" rel="noopener"&gt;&lt;U&gt;WhatTheFact.bi&lt;/U&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;DIV&gt;Follow me: &lt;A title="Click here!" href="https://twitter.com/DenSelimovic" target="_blank" rel="noopener"&gt;&lt;U&gt;twitter.com/DenSelimovic&lt;/U&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 12:50:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Combinding-lookupvalue-with-first-non-blank/m-p/1979425#M43619</guid>
      <dc:creator>selimovd</dc:creator>
      <dc:date>2021-07-26T12:50:25Z</dc:date>
    </item>
  </channel>
</rss>

