<?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: fill in blank values from most recent row for specific ID in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/fill-in-blank-values-from-most-recent-row-for-specific-ID/m-p/898419#M8166</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="185398" data-lia-user-login="EF" class="lia-mention lia-mention-user"&gt;EF&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;Well, how can PBI know which DiagnosticKey1 needs to be used then if the Account and Date can be the same? So let's say someone (Account A)has an appointment on Jan 1st for the Flu and later that day for the Cold. Then, on Jan 2, the DiagnosticKey1 is empty. What would the fill be, Flu or Cold?&lt;/P&gt;&lt;P&gt;If it doesn't matter, you can use the following as a calculated column:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;FilledDiagnosisKey = 
IF(Combined_Queries[DiagnosisKey1] = BLANK(),
    VAR _curAccount = Combined_Queries[Account]
    VAR _curDate = Combined_Queries[Date]
    VAR _filteredTable = FILTER(Combined_Queries, Combined_Queries[Account] = _curAccount &amp;amp;&amp;amp; Combined_Queries[DiagnosisKey1] &amp;lt;&amp;gt; BLANK() &amp;amp;&amp;amp; Combined_Queries[Date] &amp;lt; _curDate)
    VAR _maxDate = MAXX(_filteredTable, Combined_Queries[Date])
    RETURN
    MAXX(FILTER(_filteredTable, [Date] = _maxDate &amp;amp;&amp;amp; [Account] = _curAccount), [DiagnosisKey1])
, Combined_Queries[DiagnosisKey1])&lt;/LI-CODE&gt;&lt;P&gt;In my original test table, I added a row for Jan 1st, Account A with DiagnosticKey1 = Sick. The result is this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Let me know if this helps you. Don't forget to give kudo's for support &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;Djerro123&lt;/P&gt;&lt;P&gt;-------------------------------&lt;/P&gt;&lt;P&gt;If this answered your question, please &lt;STRONG&gt;mark it as the Solution&lt;/STRONG&gt;. This also helps others to find what they are looking for.&lt;/P&gt;&lt;P&gt;Keep those &lt;STRONG&gt;thumbs up&lt;/STRONG&gt; coming! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jan 2020 19:05:01 GMT</pubDate>
    <dc:creator>JarroVGIT</dc:creator>
    <dc:date>2020-01-13T19:05:01Z</dc:date>
    <item>
      <title>fill in blank values from most recent row for specific ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/fill-in-blank-values-from-most-recent-row-for-specific-ID/m-p/895439#M8049</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been searching this for a while.&lt;/P&gt;&lt;P&gt;I need to fill in missing data based on rows before for the specific ID.&lt;/P&gt;&lt;P&gt;The rows are records of events for each patient (admit date, appointments, discharge...)&lt;/P&gt;&lt;P&gt;Depending on the event, sometimes alot of other data is missing.&lt;/P&gt;&lt;P&gt;For example, every appointment row has the patients' current diagnosis at the time of the appointment. However, discharge events have no diagnosis associated. I want to fill the empty diagnosis with the patients most recent diagnosis.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Combined_Queries[DiagnosisKey1] = BLANK (),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;LASTNONBLANK ( Combined_Queries[DiagnosisKey1], Combined_Queries[DiagnosisKey1] ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FILTER(ALLEXCEPT ( Combined_Queries, Combined_Queries[account] ),Combined_Queries[date]&amp;lt;=earlier(Combined_Queries[date]))),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Combined_Queries[DiagnosisKey1]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;Combined_Queries is the name of the table, DiagnosisKey1 is the column missing values, account is the ID for each patient, date is date of the event.&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This fills in the first blank correctly, but every other blank gets filled with that same value. I need it to change based on the most recent event for that date.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Query Editor fill down doesn't help either because it fills down regardless of the account number.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Any ideas?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2020 20:21:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/fill-in-blank-values-from-most-recent-row-for-specific-ID/m-p/895439#M8049</guid>
      <dc:creator>EF</dc:creator>
      <dc:date>2020-01-09T20:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: fill in blank values from most recent row for specific ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/fill-in-blank-values-from-most-recent-row-for-specific-ID/m-p/895472#M8050</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="185398" data-lia-user-login="EF" class="lia-mention lia-mention-user"&gt;EF&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I started with this table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Then I used the following calculated column (this is not optimized but it is easier to read and understand the logic):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;FilledDiagnosisKey = 
IF(Combined_Queries[DiagnosisKey1] = BLANK(),
    VAR _curAccount = Combined_Queries[Account]
    VAR _curDate = Combined_Queries[Date]
    VAR _filteredTable = FILTER(Combined_Queries, Combined_Queries[Account] = _curAccount &amp;amp;&amp;amp; Combined_Queries[DiagnosisKey1] &amp;lt;&amp;gt; BLANK() &amp;amp;&amp;amp; Combined_Queries[Date] &amp;lt; _curDate)
    VAR _maxDate = MAXX(_filteredTable, Combined_Queries[Date])
    RETURN
    LOOKUPVALUE(Combined_Queries[DiagnosisKey1], Combined_Queries[Account] , _curAccount, Combined_Queries[Date] , _maxDate),
    Combined_Queries[DiagnosisKey1])&lt;/LI-CODE&gt;&lt;P&gt;Result is:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;Djerro123&lt;/P&gt;&lt;P&gt;-------------------------------&lt;/P&gt;&lt;P&gt;If this answered your question, please &lt;STRONG&gt;mark it as the Solution&lt;/STRONG&gt;. This also helps others to find what they are looking for.&lt;/P&gt;&lt;P&gt;Keep those &lt;STRONG&gt;thumbs up&lt;/STRONG&gt; coming! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2020 20:49:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/fill-in-blank-values-from-most-recent-row-for-specific-ID/m-p/895472#M8050</guid>
      <dc:creator>JarroVGIT</dc:creator>
      <dc:date>2020-01-09T20:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: fill in blank values from most recent row for specific ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/fill-in-blank-values-from-most-recent-row-for-specific-ID/m-p/895485#M8051</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="137611" data-lia-user-login="JarroVGIT" class="lia-mention lia-mention-user"&gt;JarroVGIT&lt;/a&gt;&amp;nbsp; for your quick response!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got this error message:&amp;nbsp;A table of multiple values was supplied where a single value was expected.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2020 21:10:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/fill-in-blank-values-from-most-recent-row-for-specific-ID/m-p/895485#M8051</guid>
      <dc:creator>EF</dc:creator>
      <dc:date>2020-01-09T21:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: fill in blank values from most recent row for specific ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/fill-in-blank-values-from-most-recent-row-for-specific-ID/m-p/895503#M8055</link>
      <description>&lt;P&gt;You are adding a measure, but this dax needs to be a&amp;nbsp;&lt;STRONG&gt;calculated column&lt;/STRONG&gt;. A very important difference &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; You should get any errors if applying the DAX as a&amp;nbsp;&lt;STRONG&gt;calculated column.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2020 21:29:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/fill-in-blank-values-from-most-recent-row-for-specific-ID/m-p/895503#M8055</guid>
      <dc:creator>JarroVGIT</dc:creator>
      <dc:date>2020-01-09T21:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: fill in blank values from most recent row for specific ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/fill-in-blank-values-from-most-recent-row-for-specific-ID/m-p/898119#M8157</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="137611" data-lia-user-login="JarroVGIT" class="lia-mention lia-mention-user"&gt;JarroVGIT&lt;/a&gt;&amp;nbsp;Hi I just got back on my computer...&lt;/P&gt;&lt;P&gt;I used a calculated column, still got that error message:&lt;/P&gt;&lt;P&gt;'A table of multiple values was supplied where a single value was expected.'&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 14:52:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/fill-in-blank-values-from-most-recent-row-for-specific-ID/m-p/898119#M8157</guid>
      <dc:creator>EF</dc:creator>
      <dc:date>2020-01-13T14:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: fill in blank values from most recent row for specific ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/fill-in-blank-values-from-most-recent-row-for-specific-ID/m-p/898127#M8158</link>
      <description>&lt;P&gt;Maybe that error is because it is possible for a client to have more than 1 entry for a single date? The entries are appointments and they can have multiple appointments per day (for different services)&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 14:56:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/fill-in-blank-values-from-most-recent-row-for-specific-ID/m-p/898127#M8158</guid>
      <dc:creator>EF</dc:creator>
      <dc:date>2020-01-13T14:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: fill in blank values from most recent row for specific ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/fill-in-blank-values-from-most-recent-row-for-specific-ID/m-p/898419#M8166</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="185398" data-lia-user-login="EF" class="lia-mention lia-mention-user"&gt;EF&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;Well, how can PBI know which DiagnosticKey1 needs to be used then if the Account and Date can be the same? So let's say someone (Account A)has an appointment on Jan 1st for the Flu and later that day for the Cold. Then, on Jan 2, the DiagnosticKey1 is empty. What would the fill be, Flu or Cold?&lt;/P&gt;&lt;P&gt;If it doesn't matter, you can use the following as a calculated column:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;FilledDiagnosisKey = 
IF(Combined_Queries[DiagnosisKey1] = BLANK(),
    VAR _curAccount = Combined_Queries[Account]
    VAR _curDate = Combined_Queries[Date]
    VAR _filteredTable = FILTER(Combined_Queries, Combined_Queries[Account] = _curAccount &amp;amp;&amp;amp; Combined_Queries[DiagnosisKey1] &amp;lt;&amp;gt; BLANK() &amp;amp;&amp;amp; Combined_Queries[Date] &amp;lt; _curDate)
    VAR _maxDate = MAXX(_filteredTable, Combined_Queries[Date])
    RETURN
    MAXX(FILTER(_filteredTable, [Date] = _maxDate &amp;amp;&amp;amp; [Account] = _curAccount), [DiagnosisKey1])
, Combined_Queries[DiagnosisKey1])&lt;/LI-CODE&gt;&lt;P&gt;In my original test table, I added a row for Jan 1st, Account A with DiagnosticKey1 = Sick. The result is this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Let me know if this helps you. Don't forget to give kudo's for support &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;Djerro123&lt;/P&gt;&lt;P&gt;-------------------------------&lt;/P&gt;&lt;P&gt;If this answered your question, please &lt;STRONG&gt;mark it as the Solution&lt;/STRONG&gt;. This also helps others to find what they are looking for.&lt;/P&gt;&lt;P&gt;Keep those &lt;STRONG&gt;thumbs up&lt;/STRONG&gt; coming! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 19:05:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/fill-in-blank-values-from-most-recent-row-for-specific-ID/m-p/898419#M8166</guid>
      <dc:creator>JarroVGIT</dc:creator>
      <dc:date>2020-01-13T19:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: fill in blank values from most recent row for specific ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/fill-in-blank-values-from-most-recent-row-for-specific-ID/m-p/899569#M8192</link>
      <description>&lt;P&gt;It works! Thanks so much! Useful for so many things.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 14:25:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/fill-in-blank-values-from-most-recent-row-for-specific-ID/m-p/899569#M8192</guid>
      <dc:creator>EF</dc:creator>
      <dc:date>2020-01-14T14:25:04Z</dc:date>
    </item>
  </channel>
</rss>

