<?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: Earliest Appt in the Future for each Patient in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Earliest-Appt-in-the-Future-for-each-Patient/m-p/726074#M1545</link>
    <description>&lt;PRE&gt;-- this DAX goes into a calculated column
-- in the Patient table

var __patientId = Patient[PAT_ID]
var __now = TODAY()
var __firstScheduledApptDate =
	CALCULATE(
		MIN( Encounters[APPT_DATE_TM] ),
		Encounters[APPT_STATUS] = "Scheduled",
		Encounters[PAT_ID] = __patientId,
		Encounters[APPT_DATE_TM] &amp;gt; __now
	)
return
	__firstScheduledApptDate&lt;/PRE&gt;</description>
    <pubDate>Thu, 27 Jun 2019 09:47:20 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-06-27T09:47:20Z</dc:date>
    <item>
      <title>Earliest Appt in the Future for each Patient</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Earliest-Appt-in-the-Future-for-each-Patient/m-p/725410#M1526</link>
      <description>&lt;P&gt;Good afternoon, I have 2 tables. Does anyone have suggestions for the following DAX query?&lt;/P&gt;&lt;P&gt;1. Patient - One row per unique pt identifier called PAT_ID&lt;/P&gt;&lt;P&gt;2. Encounters - One row for each patient's visit, foreign key is the pt unique identifier&lt;/P&gt;&lt;P&gt;In the patient column, I would like to add a field on the patient table that gives each patient's (see image)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a. first appt in the future&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; b. with an appt status name = 'Scheduled'&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2019 20:53:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Earliest-Appt-in-the-Future-for-each-Patient/m-p/725410#M1526</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-26T20:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest Appt in the Future for each Patient</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Earliest-Appt-in-the-Future-for-each-Patient/m-p/726074#M1545</link>
      <description>&lt;PRE&gt;-- this DAX goes into a calculated column
-- in the Patient table

var __patientId = Patient[PAT_ID]
var __now = TODAY()
var __firstScheduledApptDate =
	CALCULATE(
		MIN( Encounters[APPT_DATE_TM] ),
		Encounters[APPT_STATUS] = "Scheduled",
		Encounters[PAT_ID] = __patientId,
		Encounters[APPT_DATE_TM] &amp;gt; __now
	)
return
	__firstScheduledApptDate&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Jun 2019 09:47:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Earliest-Appt-in-the-Future-for-each-Patient/m-p/726074#M1545</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-27T09:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest Appt in the Future for each Patient</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Earliest-Appt-in-the-Future-for-each-Patient/m-p/726221#M1557</link>
      <description>&lt;P&gt;I appreciate your response. Do you have any suggestions for the error message below?&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 13:07:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Earliest-Appt-in-the-Future-for-each-Patient/m-p/726221#M1557</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-27T13:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest Appt in the Future for each Patient</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Earliest-Appt-in-the-Future-for-each-Patient/m-p/726232#M1560</link>
      <description>&lt;P&gt;1. Are you creating this as a CALCULATED COLUMN? This is NOT A MEASURE.&lt;/P&gt;&lt;P&gt;2. Secondly, you have to give the column a name. As you can see in the error message, you're trying to name the column "var __patientId." Please name your column:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[Column Name] = &amp;lt;your formula here&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 13:20:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Earliest-Appt-in-the-Future-for-each-Patient/m-p/726232#M1560</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-27T13:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: Earliest Appt in the Future for each Patient</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Earliest-Appt-in-the-Future-for-each-Patient/m-p/726247#M1562</link>
      <description>&lt;P&gt;You are absolutely correct&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FirstSchApptDate = var __patientId = 'Patients'[PAT_ID]&lt;BR /&gt;var __now = TODAY()&lt;BR /&gt;var __firstScheduledApptDate =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;MIN( 'Encounters'[APPT_DATE_TM] ),&lt;BR /&gt;'Encounters'[APPT_STATUS] = "Scheduled",&lt;BR /&gt;'Encounters'[PAT_ID] = __patientId,&lt;BR /&gt;'Encounters'[APPT_DATE_TM] &amp;gt; __now&lt;BR /&gt;)&lt;BR /&gt;return&lt;BR /&gt;__firstScheduledApptDate&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 13:51:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Earliest-Appt-in-the-Future-for-each-Patient/m-p/726247#M1562</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-27T13:51:08Z</dc:date>
    </item>
  </channel>
</rss>

