<?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 YTD of Previous Year in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-of-Previous-Year/m-p/4365527#M173334</link>
    <description>&lt;P&gt;I am trying to create a DAX measure that returns the total revenue of the previous year (2024) but only the data up until&amp;nbsp;&lt;/P&gt;&lt;P&gt;certain date of this year (2025).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an excel file that has all the sales data of the current year (2025) and another excel file with the sales data of (2024).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a measure that calulculates the total revenue from my 2025 table. (the only sales data I have is for the month of January, as it is still only the first month in 2025)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Revenue = SUM(2025[Revenue])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This sales data only has data up until the previous day, as it does not refresh until the next day. (not totally relevant, but I also have a measure that calculates the daily revenue of the previous day, which should automatically update as the days continue, so YTD would be Jan 1st - Jan 14th)&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Daily Revenue = 
CALCULATE(
SUM(2025[Revenue]),
'Calendar'[Date] = TODAY()-1)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am looking for is to calculate the total revenue from my 2024 table that is the year to date of this year, but showing sales data from the 2024 year. Meaning I want a DAX measure that gives me the sales data of 2024 with the dates of Jan 1st - Jan 14th, but have it automatically update as the days go on in this year (the next days sales data info would be Jan 1st -Jan 15th but for 2024), similar to my daily revenue DAX measure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've used DAX measures such as the one below to create this calculation, but is there another way that doesn't require me to update the DATESBETWEEN field each time a new day occurs?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2024 Revenue YTD = 
CALCULATE(
[2024 Revenue],
DATESBETWEEN(
'2024'[Date],
DATE(2024, 1, 1),
DATE(2024, 1, 14)))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jan 2025 16:57:07 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2025-01-15T16:57:07Z</dc:date>
    <item>
      <title>YTD of Previous Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-of-Previous-Year/m-p/4365527#M173334</link>
      <description>&lt;P&gt;I am trying to create a DAX measure that returns the total revenue of the previous year (2024) but only the data up until&amp;nbsp;&lt;/P&gt;&lt;P&gt;certain date of this year (2025).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an excel file that has all the sales data of the current year (2025) and another excel file with the sales data of (2024).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a measure that calulculates the total revenue from my 2025 table. (the only sales data I have is for the month of January, as it is still only the first month in 2025)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Revenue = SUM(2025[Revenue])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This sales data only has data up until the previous day, as it does not refresh until the next day. (not totally relevant, but I also have a measure that calculates the daily revenue of the previous day, which should automatically update as the days continue, so YTD would be Jan 1st - Jan 14th)&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Daily Revenue = 
CALCULATE(
SUM(2025[Revenue]),
'Calendar'[Date] = TODAY()-1)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am looking for is to calculate the total revenue from my 2024 table that is the year to date of this year, but showing sales data from the 2024 year. Meaning I want a DAX measure that gives me the sales data of 2024 with the dates of Jan 1st - Jan 14th, but have it automatically update as the days go on in this year (the next days sales data info would be Jan 1st -Jan 15th but for 2024), similar to my daily revenue DAX measure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've used DAX measures such as the one below to create this calculation, but is there another way that doesn't require me to update the DATESBETWEEN field each time a new day occurs?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2024 Revenue YTD = 
CALCULATE(
[2024 Revenue],
DATESBETWEEN(
'2024'[Date],
DATE(2024, 1, 1),
DATE(2024, 1, 14)))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 16:57:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-of-Previous-Year/m-p/4365527#M173334</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-01-15T16:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: YTD of Previous Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-of-Previous-Year/m-p/4366022#M173357</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you to try code as below to create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;2024 Revenue YTD =
VAR _RANGESTART =
    DATE ( 2024, 1, 1 )
VAR _RANGEEND =
    DATE ( YEAR ( TODAY () ) - 1, MONTH ( TODAY () ), DAY ( TODAY () ) - 1 )
RETURN
    CALCULATE (
        [2024 Revenue],
        DATESBETWEEN ( '2024'[Date], _RANGESTART, _RANGEEND )
    )&lt;/LI-CODE&gt;
&lt;P&gt;Result is as below.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can download my attachment to learn more details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 01:44:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-of-Previous-Year/m-p/4366022#M173357</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-01-16T01:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: YTD of Previous Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-of-Previous-Year/m-p/4367491#M173400</link>
      <description>&lt;P&gt;This worked, thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 14:08:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-of-Previous-Year/m-p/4367491#M173400</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-01-16T14:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: YTD of Previous Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-of-Previous-Year/m-p/4659692#M178424</link>
      <description>&lt;P&gt;Hi i have a similar issue-goal is sales from prior year only through end of prior day this year&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Measure 1&lt;/TD&gt;&lt;TD&gt;Measure 2&lt;/TD&gt;&lt;TD&gt;YTD YOY-through yesterday&lt;/TD&gt;&lt;TD&gt;Sales Order Date Last year&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Sales Order Date Present Year&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;LY Sales&lt;/TD&gt;&lt;TD&gt;PY Sales&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;2024(leap year)&lt;/TD&gt;&lt;TD&gt;2025&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sun, 20 Apr 2025 03:38:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-of-Previous-Year/m-p/4659692#M178424</guid>
      <dc:creator>jj1</dc:creator>
      <dc:date>2025-04-20T03:38:38Z</dc:date>
    </item>
    <item>
      <title>Re: YTD of Previous Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-of-Previous-Year/m-p/4659955#M178438</link>
      <description>&lt;P&gt;Try this for year-to-date :&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;2025 Revenue YTD =&lt;BR /&gt;&amp;nbsp;CALCULATE(&lt;BR /&gt;[2024 Revenue],&lt;BR /&gt;DATESYTD('Calendar'[Date])&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;And this one for Previous Year :&lt;BR /&gt;&lt;BR /&gt;2024 Revenue YTD =&amp;nbsp;CALCULATE(&lt;BR /&gt;[2024 Revenue],&lt;BR /&gt;&amp;nbsp; Dateadd(DATESYTD('Calendar'[Date]),-1,Year)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;But I would suggest to rename&amp;nbsp;2024 Revenue YTD to PY Revenue as this is dynamic. it will calculate the previous year, say if you are in other years too (i.e.&amp;nbsp; if in 2023, PY is 2022)&lt;/P&gt;</description>
      <pubDate>Sun, 20 Apr 2025 13:42:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-of-Previous-Year/m-p/4659955#M178438</guid>
      <dc:creator>DAXian</dc:creator>
      <dc:date>2025-04-20T13:42:24Z</dc:date>
    </item>
  </channel>
</rss>

