<?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: LY YTD (total) in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LY-YTD-total/m-p/3753380#M146435</link>
    <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="623734" data-lia-user-login="FR14" class="lia-mention lia-mention-user"&gt;FR14&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I belive you can use DATESYTD function based on your calendar table.&amp;nbsp; Make sure you have properly built di calendar table as&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;&amp;nbsp; mentioned before you go.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First create measure that will make you are not showing values for future dates in your calendar table:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ShowValueForDates :=
VAR LastDateWithData =
    CALCULATE (
        MAX ( OrderLine[Open_Date] ),
        REMOVEFILTERS ()
    )
VAR FirstDateVisible =
    MIN ( 'Date'[Date] )
VAR Result =
    FirstDateVisible &amp;lt;= LastDateWithData
RETURN
    Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Secondly create this measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;LY YTD Bookings = 
IF(
    [ShowValueForDates],
    CALCULATE(
        SUM ( OrderLine[Booking USD] ),
        DATESYTD('Date'[Date])
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My LinkedIn:&amp;nbsp;&lt;A href="http://www.linkedin.com/in/lukasz-kozdron" target="_blank" rel="noopener nofollow noreferrer"&gt;www.linkedin.com/in/lukasz-kozdron&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 10 Mar 2024 16:19:33 GMT</pubDate>
    <dc:creator>StrategicSavvy</dc:creator>
    <dc:date>2024-03-10T16:19:33Z</dc:date>
    <item>
      <title>LY YTD (total)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LY-YTD-total/m-p/3752473#M146378</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Hi Everyone,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Using following formula below, i am able to get the LY YTD for the exact month and day amount BUT when i fliter all the months the total LY YTD doesn't show correct amount, do you guys know what condition should be added to this DAX to also have the total LY YTD correct when we filter all the months?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;LY YTD Bookings = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; _MaxDate = &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(OrderLine[Open_Date])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; _PreviousYear = &lt;/SPAN&gt;&lt;SPAN&gt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&gt;&lt;SPAN&gt;Thank you all so much for your support.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 09 Mar 2024 08:44:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LY-YTD-total/m-p/3752473#M146378</guid>
      <dc:creator>FR14</dc:creator>
      <dc:date>2024-03-09T08:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: LY YTD (total)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LY-YTD-total/m-p/3752633#M146394</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure how your semantic model looks like, but I suggest using Calendar Dimension table to alter filter context.&lt;/P&gt;
&lt;P&gt;But, by using only the situation shown here, please try something like below whether it produces the expected result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LY YTD Bookings =
VAR _MaxDate =
    MAX ( OrderLine[Open_Date] )
VAR _PreviousYear =
    YEAR ( _MaxDate ) - 1
RETURN
    CALCULATE (
        SUM ( OrderLine[Booking USD] ),
        REMOVEFILTERS ( OrderLine[Open_Date] ),
        YEAR ( OrderLine[Open_Date] ) = _PreviousYear,
        MONTH ( OrderLine[Open_Date] ) &amp;lt;= MONTH ( _MaxDate ),
        DAY ( OrderLine[Open_Date] ) &amp;lt;= DAY ( _MaxDate )
    )
&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 09 Mar 2024 12:19:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LY-YTD-total/m-p/3752633#M146394</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2024-03-09T12:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: LY YTD (total)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LY-YTD-total/m-p/3753234#M146430</link>
      <description>&lt;P&gt;Thank you but it didn't solve my problem unfotunately still the amount for the LY YTD to this day of the month is showing correct but then whe select JAN,FEB &amp;amp; March last year the total is not corrrect &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Mar 2024 10:00:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LY-YTD-total/m-p/3753234#M146430</guid>
      <dc:creator>FR14</dc:creator>
      <dc:date>2024-03-10T10:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: LY YTD (total)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LY-YTD-total/m-p/3753380#M146435</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="623734" data-lia-user-login="FR14" class="lia-mention lia-mention-user"&gt;FR14&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I belive you can use DATESYTD function based on your calendar table.&amp;nbsp; Make sure you have properly built di calendar table as&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;&amp;nbsp; mentioned before you go.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First create measure that will make you are not showing values for future dates in your calendar table:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ShowValueForDates :=
VAR LastDateWithData =
    CALCULATE (
        MAX ( OrderLine[Open_Date] ),
        REMOVEFILTERS ()
    )
VAR FirstDateVisible =
    MIN ( 'Date'[Date] )
VAR Result =
    FirstDateVisible &amp;lt;= LastDateWithData
RETURN
    Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Secondly create this measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;LY YTD Bookings = 
IF(
    [ShowValueForDates],
    CALCULATE(
        SUM ( OrderLine[Booking USD] ),
        DATESYTD('Date'[Date])
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My LinkedIn:&amp;nbsp;&lt;A href="http://www.linkedin.com/in/lukasz-kozdron" target="_blank" rel="noopener nofollow noreferrer"&gt;www.linkedin.com/in/lukasz-kozdron&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Mar 2024 16:19:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LY-YTD-total/m-p/3753380#M146435</guid>
      <dc:creator>StrategicSavvy</dc:creator>
      <dc:date>2024-03-10T16:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: LY YTD (total)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LY-YTD-total/m-p/3765599#M146963</link>
      <description>&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="623734" data-lia-user-login="FR14" class="lia-mention lia-mention-user"&gt;FR14&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;If these also don't help, please share more detailed information and description to help us clarify your scenario to test.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;&lt;A href="http://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;How to Get Your Question Answered Quickly&amp;nbsp;&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Xiaoxin Sheng&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 08:34:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LY-YTD-total/m-p/3765599#M146963</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-15T08:34:33Z</dc:date>
    </item>
  </channel>
</rss>

