<?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: How to create a new measure for dates in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-new-measure-for-dates/m-p/2744789#M84516</link>
    <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;Assuming you do not have a continuous date table, you would need to add a date table (the month-year column) will filter both of your other tablesafter forming a relationship on the date field.You should also mark your date table as a date table. Here is some code below(table name = "Dates"&amp;nbsp; you can use to create a date table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MODELING&amp;gt;NEW TABLE&amp;gt; then this code:&lt;/P&gt;
&lt;P&gt;Dates = ADDCOLUMNS ( CALENDAR (DATE(2020,01,01), TODAY()), "year", YEAR ( [Date] ), "MonthNumber", FORMAT ( [Date], "MM" ), "year-month", FORMAT ( [Date], "YYYY-MM" ), "month-year", FORMAT ( [Date], "MM-'YY" ) )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps!&lt;/P&gt;</description>
    <pubDate>Sat, 03 Sep 2022 12:59:41 GMT</pubDate>
    <dc:creator>Whitewater100</dc:creator>
    <dc:date>2022-09-03T12:59:41Z</dc:date>
    <item>
      <title>How to create a new measure for dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-new-measure-for-dates/m-p/2744508#M84490</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables with two different ranges of dates, I want to create a new slicer to filter both by month and year&lt;/P&gt;&lt;P&gt;How can I do this with a new measure ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 23:25:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-new-measure-for-dates/m-p/2744508#M84490</guid>
      <dc:creator>Yul</dc:creator>
      <dc:date>2022-09-02T23:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new measure for dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-new-measure-for-dates/m-p/2744640#M84496</link>
      <description>&lt;P&gt;Create a new date table that will have dates from both tables and connect it to the other ones. I don't understand what you mean by "&lt;SPAN&gt;How can I do this with a new measure?." But I don't even understand why you have 2 different date tables... You should have one that stores dates that span the whole period you want to work with in any of your other tables. By the way, you should have one calendar in your model. If you have 2 tables with dates in them, then you should create a calendar and connect it to the tables. Why complicate things that can be simple?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Sep 2022 08:09:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-new-measure-for-dates/m-p/2744640#M84496</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-09-03T08:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new measure for dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-new-measure-for-dates/m-p/2744789#M84516</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;Assuming you do not have a continuous date table, you would need to add a date table (the month-year column) will filter both of your other tablesafter forming a relationship on the date field.You should also mark your date table as a date table. Here is some code below(table name = "Dates"&amp;nbsp; you can use to create a date table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MODELING&amp;gt;NEW TABLE&amp;gt; then this code:&lt;/P&gt;
&lt;P&gt;Dates = ADDCOLUMNS ( CALENDAR (DATE(2020,01,01), TODAY()), "year", YEAR ( [Date] ), "MonthNumber", FORMAT ( [Date], "MM" ), "year-month", FORMAT ( [Date], "YYYY-MM" ), "month-year", FORMAT ( [Date], "MM-'YY" ) )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps!&lt;/P&gt;</description>
      <pubDate>Sat, 03 Sep 2022 12:59:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-new-measure-for-dates/m-p/2744789#M84516</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-09-03T12:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new measure for dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-new-measure-for-dates/m-p/2749232#M84774</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="436725" data-lia-user-login="Yul" class="lia-mention lia-mention-user"&gt;Yul&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I created some data:&lt;/P&gt;
&lt;P&gt;TableA:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;TableB:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Table:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Here are the steps you can follow：&lt;/P&gt;
&lt;P&gt;1. Create measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Flag =
var _selectmin=MINX(ALLSELECTED('Table'),[Date])
var _selectmax=MAXX(ALLSELECTED('Table'),[Date])
return
IF(
    AND(
       MAX('TableA'[Date])&amp;gt;=_selectmin,MAX('TableA'[Date])&amp;lt;=_selectmax)
    ||
    AND(
        MAX('TableB'[Date])&amp;gt;=_selectmin,MAX('TableB'[Date])&amp;lt;=_selectmax)
        ,1
        ,0)&lt;/LI-CODE&gt;
&lt;P&gt;2. Place [Flag] in Visual's Filter and set is=1.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;3. Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If you need pbix, please click here.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://m365x97431909-my.sharepoint.com/:u:/g/personal/ly_m365x97431909_onmicrosoft_com/Ed2lR_0zINBAsAtFHpzfrLwB8zsTcHUE9LBGDXcwniedyg?e=P1fsKJ" target="_blank"&gt;&lt;SPAN&gt;How to create a new measure for dates.pbix&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 05:48:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-new-measure-for-dates/m-p/2749232#M84774</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-06T05:48:54Z</dc:date>
    </item>
  </channel>
</rss>

