<?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 Data grouping based on second table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Data-grouping-based-on-second-table/m-p/3584039#M138270</link>
    <description>&lt;P&gt;Dear Experts,&lt;/P&gt;&lt;P&gt;I'm looking for a solution to a problem I cannot deal with&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables: Periods:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and invoices:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;every period for every country is different&lt;/P&gt;&lt;P&gt;Based on country and invoice date I would like to know to which period from the "period" table the&amp;nbsp;invoice belongs to&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I need your help as I have no idea how to deal with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;the result should be:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if the user chooses the country&amp;nbsp; and period should get a list of invoices&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help in advance&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Dec 2023 13:29:11 GMT</pubDate>
    <dc:creator>Mike1309</dc:creator>
    <dc:date>2023-12-14T13:29:11Z</dc:date>
    <item>
      <title>Data grouping based on second table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Data-grouping-based-on-second-table/m-p/3584039#M138270</link>
      <description>&lt;P&gt;Dear Experts,&lt;/P&gt;&lt;P&gt;I'm looking for a solution to a problem I cannot deal with&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables: Periods:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and invoices:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;every period for every country is different&lt;/P&gt;&lt;P&gt;Based on country and invoice date I would like to know to which period from the "period" table the&amp;nbsp;invoice belongs to&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I need your help as I have no idea how to deal with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;the result should be:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if the user chooses the country&amp;nbsp; and period should get a list of invoices&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help in advance&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 13:29:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Data-grouping-based-on-second-table/m-p/3584039#M138270</guid>
      <dc:creator>Mike1309</dc:creator>
      <dc:date>2023-12-14T13:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: Data grouping based on second table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Data-grouping-based-on-second-table/m-p/3584675#M138300</link>
      <description>&lt;P&gt;All you need is a "Date Table". Search google/ youtube. It's not very difficult.&lt;/P&gt;&lt;P&gt;1. Make a Date Table.&lt;/P&gt;&lt;P&gt;2. Link your 2 tables to that Date Table.&lt;/P&gt;&lt;P&gt;3. Add a Slicer to your matrix, something look like this one, allowing users to choose "Period" and "Country".&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;</description>
      <pubDate>Thu, 14 Dec 2023 21:37:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Data-grouping-based-on-second-table/m-p/3584675#M138300</guid>
      <dc:creator>Tom_Y</dc:creator>
      <dc:date>2023-12-14T21:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: Data grouping based on second table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Data-grouping-based-on-second-table/m-p/3585343#M138321</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="560244" data-lia-user-login="Mike1309" class="lia-mention lia-mention-user"&gt;Mike1309&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have understood about your problem, here is the solution I offer:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the data of the two tables, you can check the date type, here it is recommended to use the (m/d/yyyy) format&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a&amp;nbsp; measure, you can match the period by judging the country name and date range.&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;LI-CODE lang="markup"&gt;result = var invoiceDate = SELECTEDVALUE(invoices[invoice date])
 var invoiceCountry = SELECTEDVALUE(invoices[country])

 RETURN CALCULATE(
        MAX(periods[period]),
    FILTER(periods, 
        periods[country] = invoiceCountry &amp;amp;&amp;amp; 
        periods[start day] &amp;lt;= invoiceDate &amp;amp;&amp;amp;
        periods[end day] &amp;gt;= invoiceDate))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the result, and you can add slicers to filter&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Nono Chen&lt;/P&gt;
&lt;P&gt;If this&lt;STRONG&gt;&lt;EM&gt; post&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;helps, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution &lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 08:02:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Data-grouping-based-on-second-table/m-p/3585343#M138321</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-12-15T08:02:24Z</dc:date>
    </item>
  </channel>
</rss>

