<?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: Adding Multiple columns based on the maximum value of a column in another table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-Multiple-columns-based-on-the-maximum-value-of-a-column/m-p/921520#M9110</link>
    <description>&lt;P&gt;Hi there. This is a Data Model issue. Please consider reading about star schema.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have two ways to fix this that I would recommend.&lt;/P&gt;&lt;P&gt;1- In case a person has a No. items issued, returned and lost by date, then merge this tables together by person and date in one table in edit queries. With power query you should congregate an unique table with people id dates and calculations. That sould be your fact table. This way you have only one table with results and this should be on Power Query and not in DAX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2- Another solution would be creating a dimension (table) for date (calendar like &lt;A href="https://blog.ladataweb.com.ar/post/185012464051/data-modeling-como-hago-una-tabla-fecha" target="_self"&gt;this&lt;/A&gt;) and for persons with the unique ids. Then you won't relate both tables as&amp;nbsp; many to many. You will related both tables to DateTable and PersonsTable. Then any visualization you do with Person or Date with a value of No.Items will relate automatically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope have described the point correctly. Otherwise ask again.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Feb 2020 18:19:44 GMT</pubDate>
    <dc:creator>ibarrau</dc:creator>
    <dc:date>2020-02-04T18:19:44Z</dc:date>
    <item>
      <title>Adding Multiple columns based on the maximum value of a column in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-Multiple-columns-based-on-the-maximum-value-of-a-column/m-p/921157#M9091</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I'm pretty new to DAX and I can't seem to find a solution which&amp;nbsp;covers exactly what I am trying to achieve.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 2 calculated tables as below, with a many to many relationship&amp;nbsp;which I need to join&amp;nbsp;as shown in the RESULTS table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ITEM ISSUES&amp;nbsp;lists the number of&amp;nbsp;items&amp;nbsp;&amp;nbsp;issued to&amp;nbsp;each person on&amp;nbsp;a particular date.&lt;/P&gt;&lt;P&gt;ITEM RETURNS &amp;nbsp;shows the number of items returned, the number lost and the date they were returned&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to join the tables based on the next return date after the current issue date for each person/item issue date combination.&lt;/P&gt;&lt;P&gt;So&amp;nbsp;for example, where&amp;nbsp;Person 1&amp;nbsp;has an item&amp;nbsp;issue date of 01-Dec-19&amp;nbsp; I need items returned, items lost and the return date&amp;nbsp; from ITEM RETURNS where the corresponding return date is the earliest date which is &amp;gt;= issue date, i.e. 01-Jan-20&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ITEM ISSUES&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Person ID&lt;/TD&gt;&lt;TD&gt;No Items Issued&lt;/TD&gt;&lt;TD&gt;Date Issued&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;01-D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t;&lt;TD&gt;01-Dec-20&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 04 Feb 2020 12:07:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-Multiple-columns-based-on-the-maximum-value-of-a-column/m-p/921157#M9091</guid>
      <dc:creator>m196804</dc:creator>
      <dc:date>2020-02-04T12:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Multiple columns based on the maximum value of a column in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-Multiple-columns-based-on-the-maximum-value-of-a-column/m-p/921520#M9110</link>
      <description>&lt;P&gt;Hi there. This is a Data Model issue. Please consider reading about star schema.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have two ways to fix this that I would recommend.&lt;/P&gt;&lt;P&gt;1- In case a person has a No. items issued, returned and lost by date, then merge this tables together by person and date in one table in edit queries. With power query you should congregate an unique table with people id dates and calculations. That sould be your fact table. This way you have only one table with results and this should be on Power Query and not in DAX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2- Another solution would be creating a dimension (table) for date (calendar like &lt;A href="https://blog.ladataweb.com.ar/post/185012464051/data-modeling-como-hago-una-tabla-fecha" target="_self"&gt;this&lt;/A&gt;) and for persons with the unique ids. Then you won't relate both tables as&amp;nbsp; many to many. You will related both tables to DateTable and PersonsTable. Then any visualization you do with Person or Date with a value of No.Items will relate automatically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope have described the point correctly. Otherwise ask again.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 18:19:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-Multiple-columns-based-on-the-maximum-value-of-a-column/m-p/921520#M9110</guid>
      <dc:creator>ibarrau</dc:creator>
      <dc:date>2020-02-04T18:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Multiple columns based on the maximum value of a column in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-Multiple-columns-based-on-the-maximum-value-of-a-column/m-p/922726#M9162</link>
      <description>&lt;P&gt;Thank you for your reply &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="11211" data-lia-user-login="ibarrau" class="lia-mention lia-mention-user"&gt;ibarrau&lt;/a&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please could you explain further how to merge the tables together in Power Query?&lt;/P&gt;&lt;P&gt;If I was to do this in SQL I would just&amp;nbsp;join on the Person ID and use a subquery to get the earliest ITEMS RETURNED[Date Returend] that is greater than the ITEM ISSUES[Date Issued] but I can't figure out how to do this within Power BI.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2020 14:52:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-Multiple-columns-based-on-the-maximum-value-of-a-column/m-p/922726#M9162</guid>
      <dc:creator>m196804</dc:creator>
      <dc:date>2020-02-05T14:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Multiple columns based on the maximum value of a column in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-Multiple-columns-based-on-the-maximum-value-of-a-column/m-p/923038#M9175</link>
      <description>&lt;P&gt;Hey, if you can do it on SQL go ahead. There is nothing fater that a database engine for joining tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you wanto to do it in edit queries. There is a button to do it. Check this links:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/power-bi/desktop-shape-and-combine-data#combine-queries" target="_blank"&gt;https://docs.microsoft.com/en-us/power-bi/desktop-shape-and-combine-data#combine-queries&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://radacad.com/append-vs-merge-in-power-bi-and-power-query" target="_blank"&gt;https://radacad.com/append-vs-merge-in-power-bi-and-power-query&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Consider adding a column of the combination of personid and date in order to get a unique column to do the merge. You can check how the transformation is done here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://youtu.be/K80MdUjyPEI?t=47" target="_blank"&gt;https://youtu.be/K80MdUjyPEI?t=47&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2020 17:50:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-Multiple-columns-based-on-the-maximum-value-of-a-column/m-p/923038#M9175</guid>
      <dc:creator>ibarrau</dc:creator>
      <dc:date>2020-02-05T17:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Multiple columns based on the maximum value of a column in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-Multiple-columns-based-on-the-maximum-value-of-a-column/m-p/924092#M9229</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="11211" data-lia-user-login="ibarrau" class="lia-mention lia-mention-user"&gt;ibarrau&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;Unfortunately my data sources are flat files so I can't use SQL but following your suggestion, I created a unique key in Power Query on the Person ID and dates which works perfectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 14:24:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-Multiple-columns-based-on-the-maximum-value-of-a-column/m-p/924092#M9229</guid>
      <dc:creator>m196804</dc:creator>
      <dc:date>2020-02-06T14:24:52Z</dc:date>
    </item>
  </channel>
</rss>

