<?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: Trying to Create new Column/measure thats matched on ID and a Date Range in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2220886#M52712</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;, You can add a new column in order and can connect directly with Customer History Table&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Join ID = &lt;BR /&gt;var _max = maxx(filter('Customer Historty Table','Customer Historty Table'[PostedDate] &amp;lt;='Order'[SurveyDate]&lt;BR /&gt;&amp;amp;&amp;amp; 'Customer Historty Table'[CustomerID] &amp;lt;='Order'[CustomerID] ),'Customer Historty Table'[PostedDate]) &lt;BR /&gt;return &lt;BR /&gt;maxx(filter('Customer Historty Table','Customer Historty Table'[PostedDate] =_max&lt;BR /&gt;&amp;amp;&amp;amp; 'Customer Historty Table'[CustomerID] &amp;lt;='Order'[CustomerID] ),'Customer Historty Table'[ID]) &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 04 Dec 2021 11:58:18 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2021-12-04T11:58:18Z</dc:date>
    <item>
      <title>Trying to Create new Column/measure thats matched on ID and a Date Range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2220670#M52692</link>
      <description>&lt;P&gt;The three tables I have are shown below&lt;/P&gt;&lt;P&gt;Customer Historty Table&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;CustomerID&lt;/TD&gt;&lt;TD&gt;PostedDate&lt;/TD&gt;&lt;TD&gt;Old Address&lt;/TD&gt;&lt;TD&gt;New Address&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;951753&lt;/TD&gt;&lt;TD&gt;879564213&lt;/TD&gt;&lt;TD&gt;1/10/2021&lt;/TD&gt;&lt;TD&gt;123 N Way&lt;/TD&gt;&lt;TD&gt;789 S Broadway&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;753951&lt;/TD&gt;&lt;TD&gt;879564213&lt;/TD&gt;&lt;TD&gt;1/01/2021&lt;/TD&gt;&lt;TD&gt;Null&lt;/TD&gt;&lt;TD&gt;123 N Way&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;357159&lt;/TD&gt;&lt;TD&gt;231564879&lt;/TD&gt;&lt;TD&gt;12/31/2021&lt;/TD&gt;&lt;TD&gt;Null&lt;/TD&gt;&lt;TD&gt;456 E Central&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Customer Table&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID (CustomerID)&lt;/TD&gt;&lt;TD&gt;ReportedDate&lt;/TD&gt;&lt;TD&gt;Current Address&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;879564213&lt;/TD&gt;&lt;TD&gt;1/10/2021&lt;/TD&gt;&lt;TD&gt;789 S Broadway&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;231564879&lt;/TD&gt;&lt;TD&gt;12/31/2021&lt;/TD&gt;&lt;TD&gt;456 E Central&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Order Table&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;OrderID&lt;/TD&gt;&lt;TD&gt;CustomerID&lt;/TD&gt;&lt;TD&gt;SurveyDate&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;987564213&lt;/TD&gt;&lt;TD&gt;879564213&lt;/TD&gt;&lt;TD&gt;1/12/2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;321654987&lt;/TD&gt;&lt;TD&gt;879564213&lt;/TD&gt;&lt;TD&gt;1/12/2021&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently if I wanted to pull order information for OrderID&amp;nbsp;987564213 it would return multiple address or just the current one. If I only tied it to the&amp;nbsp;Customer Table then I would only get the most current address, not necessarily the one the customer lived at when they made the order. But if I tie it to the&amp;nbsp;Customer Historty Table then I would get multiple address for the order with no way of knowing which one was the ACTUAL address at the time of the order.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I would like is either a new column in the Customer Historty Table that would expand the table to include every single day and put&amp;nbsp; the respective customer address for each day. Or a mesure in the&amp;nbsp;Order Table that could do something similar, by using the order date to determine which Address to use if its after or before they changed address.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I have tried is a mesure that checks the order date and compares it to the latest&amp;nbsp;PostedDate in the customer history table. This did not work as some customers have moved many times a few years so using the latest date wouldnt work.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Dec 2021 22:51:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2220670#M52692</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-03T22:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Create new Column/measure thats matched on ID and a Date Range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2220886#M52712</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;, You can add a new column in order and can connect directly with Customer History Table&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Join ID = &lt;BR /&gt;var _max = maxx(filter('Customer Historty Table','Customer Historty Table'[PostedDate] &amp;lt;='Order'[SurveyDate]&lt;BR /&gt;&amp;amp;&amp;amp; 'Customer Historty Table'[CustomerID] &amp;lt;='Order'[CustomerID] ),'Customer Historty Table'[PostedDate]) &lt;BR /&gt;return &lt;BR /&gt;maxx(filter('Customer Historty Table','Customer Historty Table'[PostedDate] =_max&lt;BR /&gt;&amp;amp;&amp;amp; 'Customer Historty Table'[CustomerID] &amp;lt;='Order'[CustomerID] ),'Customer Historty Table'[ID]) &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Dec 2021 11:58:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2220886#M52712</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-12-04T11:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Create new Column/measure thats matched on ID and a Date Range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2220893#M52716</link>
      <description>&lt;P&gt;Hi NotRick,&lt;BR /&gt;&lt;BR /&gt;I am not sure if I understood correctly but in essence: you want to get the NewAddress information for a order during the time of order (SurveyDate)?&lt;BR /&gt;&lt;BR /&gt;This can be achieved with the following measure:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Addres during the time of order = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;orderDate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;OrderTable[SurveyDate]&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;CustomerHistory[New Address]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;CustomerHistory[PostedDate]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN&gt;orderDate&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;While using this measure in the order table the end results looks as follows:&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;SPAN&gt;&lt;BR /&gt;Hopefully this solves your problem.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 04 Dec 2021 12:11:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2220893#M52716</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2021-12-04T12:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Create new Column/measure thats matched on ID and a Date Range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2223321#M52847</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343431" data-lia-user-login="ValtteriN" class="lia-mention lia-mention-user"&gt;ValtteriN&lt;/a&gt;&amp;nbsp;Thanks for the response, Im having trouble understadning how this would work? So if im inderstanding the DAX correctly it is making a variable for the date of the order. Then returing the value in the new_address coloumn if posted date is less than or equal to the variable orderdate.&amp;nbsp; How does that return the correct address if 9/01/2021 (orderDate) is greather than the last posted date? Also what does the MAX function do here? Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 16:25:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2223321#M52847</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-06T16:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Create new Column/measure thats matched on ID and a Date Range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2223358#M52852</link>
      <description>&lt;P&gt;Hi, The MAX is used on the variable to select a single value. Without MAX of something similar like selectedvalue The formula doesn't work. The Logic behind The posted date is as follows: The way I understood your question is that 'customer history' contains the date when a customers address changed [posted date]. If this posted date is lower than the order date DAX selects The MAX case our of this data so the latest row where the customer's address changed. Does this clarify the DAX?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 16:38:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2223358#M52852</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2021-12-06T16:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Create new Column/measure thats matched on ID and a Date Range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2223375#M52856</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343431" data-lia-user-login="ValtteriN" class="lia-mention lia-mention-user"&gt;ValtteriN&lt;/a&gt;&lt;BR /&gt;Yes postedDate is when a customers address was changed. I just asking because I am trying to understand why its not working. I am looking at one customer and all address returned ,total of 5, are the same and its returning the most recent address not the one at the time of the order. Would that fact the relationship is many to many break the DAX?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 16:54:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2223375#M52856</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-06T16:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Create new Column/measure thats matched on ID and a Date Range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2223616#M52863</link>
      <description>&lt;P&gt;Yeah, like you suggested m:n relationship will cause issues. This is the data model I used in my example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Is it possible to modify your model to mirror this? (I used CustomerID as the key)&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 18:57:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2223616#M52863</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2021-12-06T18:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Create new Column/measure thats matched on ID and a Date Range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2223699#M52865</link>
      <description>&lt;P&gt;I changed the model to look like that, and now its returning the same address for all rows of that customer, and wierdest part its not even an address thats associated with that customer.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 20:04:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2223699#M52865</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-06T20:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Create new Column/measure thats matched on ID and a Date Range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2223795#M52874</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;That sounds quite confusing. My first instinct is that there is a problem with relationships or that the column you are using in the visulization causes the issue. Typically when a measure returns the same value for all the rows there is a issue with the relationship this is especially true if the row is duplicated or the returned value doesn't make any sense. In this case since the measure I used in my example returns values that make sense I am leaning even more towards this.&lt;BR /&gt;&lt;BR /&gt;Usually in this situation I double the data intregity of my key columns. So my question at this point is are you sure the data type is the same with your ID columns and have you done "clean" and "trim" steps in powerquery?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 20:50:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-Create-new-Column-measure-thats-matched-on-ID-and-a/m-p/2223795#M52874</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2021-12-06T20:50:37Z</dc:date>
    </item>
  </channel>
</rss>

