<?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: undefined in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/undefined/m-p/3917018#M152479</link>
    <description>&lt;P&gt;I tried it but it does not work dear ,&lt;/P&gt;&lt;P&gt;actually , i have created a calendar spanning from 2014 to 2024 and used it as a filter to segment the dates (linked it to my table).&lt;/P&gt;&lt;P&gt;and i have created three measures for this purpose. However, I'm encountering difficulties with the "LAST MONTH'S SALES (SAME PERIOD)" measure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&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;my table is as below :&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 May 2024 10:42:16 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-05-14T10:42:16Z</dc:date>
    <item>
      <title>undefined</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/undefined/m-p/3915255#M152427</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;please I'm trying to calculate a measure for the last month same period and display it on a matrix visual , where I'm having the sales per day .&lt;/P&gt;&lt;P&gt;i.e if today is 14.05.2024 , I want to calculate sum sales for the previous month ( from the 1st to 14 / 04 .2024&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please any help !!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2024 23:11:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/undefined/m-p/3915255#M152427</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-13T23:11:32Z</dc:date>
    </item>
    <item>
      <title>Re: undefined</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/undefined/m-p/3915280#M152430</link>
      <description>&lt;P&gt;You can use a DAX query for timeframes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Calendar Timeframe = 
VAR _today_date =                   'Properties'[Today Date] // or TODAY() or DATE(2023, 07, 15)
VAR _month_start =                  DATE( YEAR(_today_date), MONTH(_today_date), 01 )
VAR _month_start_py =               DATE( YEAR(_today_date) - 1, MONTH(_today_date), 01 )
VAR _today_date_py =                DATE( YEAR(_today_date) - 1, MONTH(_today_date), DAY(_today_date) )

VAR _result = 
    UNION (
      ADDCOLUMNS (CALENDAR ( _month_start, _today_date ),       "Timeframe", "MTD",     "Timeframe Order", 1 )
    , ADDCOLUMNS (CALENDAR ( _month_start_py, _today_date_py ), "Timeframe", "MTD_PY",  "Timeframe Order", 2 )
    )

RETURN
_result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then create the relationship to your calendar table&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;After that you can use one measure to calculate each timeframe.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I have more examples of timeframes in my GitHub project &lt;A href="https://github.com/SQL-Server-projects/Reporting-Services-examples/blob/master/Miscellaneous/Scripts/DAX/Calendar_Timeframe.dax" target="_self"&gt;here&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 05:35:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/undefined/m-p/3915280#M152430</guid>
      <dc:creator>aduguid</dc:creator>
      <dc:date>2024-05-14T05:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: undefined</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/undefined/m-p/3917018#M152479</link>
      <description>&lt;P&gt;I tried it but it does not work dear ,&lt;/P&gt;&lt;P&gt;actually , i have created a calendar spanning from 2014 to 2024 and used it as a filter to segment the dates (linked it to my table).&lt;/P&gt;&lt;P&gt;and i have created three measures for this purpose. However, I'm encountering difficulties with the "LAST MONTH'S SALES (SAME PERIOD)" measure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&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;my table is as below :&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 10:42:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/undefined/m-p/3917018#M152479</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-14T10:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: undefined</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/undefined/m-p/3919925#M152578</link>
      <description>&lt;P&gt;&lt;FONT&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the reply from &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="81736" data-lia-user-login="aduguid" class="lia-mention lia-mention-user"&gt;aduguid&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;Anonymous&lt;/a&gt;&amp;nbsp;, the following testing is for your reference:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My sample:&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 measure as follows&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR _lmonthfirstday = EOMONTH(TODAY(), -2) + 1
VAR _lmonth = EDATE(TODAY(), -1)
VAR _sum = CALCULATE(SUM('Table'[Value]), FILTER('Table', [Date] &amp;gt;= _lmonthfirstday &amp;amp;&amp;amp; [Date] &amp;lt;= _lmonth))
RETURN
_sum&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since I don't know what your data structure is like, I have only tested up to this point, so if the method has problems with your data, please provide some data so that I can better help you.&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;How to provide sample data in the Power BI Forum - Microsoft Fabric Community&lt;/A&gt;&amp;nbsp;.&amp;nbsp;Or show it as a screenshot or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yulia Xu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 08:33:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/undefined/m-p/3919925#M152578</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-15T08:33:24Z</dc:date>
    </item>
  </channel>
</rss>

