<?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: PY YTD function is not working in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PY-YTD-function-is-not-working/m-p/2413007#M63639</link>
    <description>&lt;P&gt;Try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Discount YTD PY = CALCULATE([Discount ex VAT], SAMEPERIODLASTYEAR(DATESYTD(Kalender[Date])))&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 23 Mar 2022 16:37:10 GMT</pubDate>
    <dc:creator>johnt75</dc:creator>
    <dc:date>2022-03-23T16:37:10Z</dc:date>
    <item>
      <title>PY YTD function is not working</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PY-YTD-function-is-not-working/m-p/2412812#M63627</link>
      <description>&lt;P&gt;Hey All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create last year YTD functions. the function I am trying to use is the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Discount YTD PY =&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[Discount ex VAT]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;DATESYTD&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DATEADD&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Kalender[Date]&lt;/SPAN&gt;&lt;SPAN&gt;,-&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;year&lt;/SPAN&gt;&lt;SPAN&gt;)))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Where the discount function is:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Discount ex VAT = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FACT_Orders&lt;/SPAN&gt;&lt;SPAN&gt;,(&lt;/SPAN&gt;&lt;SPAN&gt;FACT_Orders[Discount Amount]&lt;/SPAN&gt;&lt;SPAN&gt;/((&lt;/SPAN&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FACT_Orders[Tax Price]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN&gt;FACT_Orders[Tax Rate]&lt;/SPAN&gt;&lt;SPAN&gt;)))))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Could someone please explain how to make a YTD PY work? My function will return the full year value of last year rather than the ytd value of previous year.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 23 Mar 2022 15:18:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PY-YTD-function-is-not-working/m-p/2412812#M63627</guid>
      <dc:creator>stino123</dc:creator>
      <dc:date>2022-03-23T15:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: PY YTD function is not working</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PY-YTD-function-is-not-working/m-p/2412974#M63634</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="340844" data-lia-user-login="stino123" class="lia-mention lia-mention-user"&gt;stino123&lt;/a&gt; , if you are using year to display or there is no date selected than dates ytd a year behind will give full year &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can force LYTD like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LYTD QTY forced= &lt;BR /&gt;var _max = date(year(today())-1,month(today()),day(today()))&lt;BR /&gt;return&lt;BR /&gt;if(max('Date'[Date])&amp;lt;=_max, CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),'Date'[Date]&amp;lt;=_max), blank())&lt;BR /&gt;//OR&lt;BR /&gt;//CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),'Date'[Date]&amp;lt;=_max)&lt;BR /&gt;//TOTALYTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year),'Date'[Date]&amp;lt;=_max)&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;LYTD QTY forced=&lt;BR /&gt;var _today = maxx(allselected('Order'),'order'[Date])&lt;BR /&gt;var _max = date(year(_today)-1,month(_today),day(_today))&lt;BR /&gt;return&lt;BR /&gt;if(max('Date'[Date])&amp;lt;=_max, CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),'Date'[Date]&amp;lt;=_max), blank())&lt;BR /&gt;//OR&lt;BR /&gt;//CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),'Date'[Date]&amp;lt;=_max)&lt;BR /&gt;//TOTALYTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year),'Date'[Date]&amp;lt;=_max)&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 16:20:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PY-YTD-function-is-not-working/m-p/2412974#M63634</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-03-23T16:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: PY YTD function is not working</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PY-YTD-function-is-not-working/m-p/2413007#M63639</link>
      <description>&lt;P&gt;Try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Discount YTD PY = CALCULATE([Discount ex VAT], SAMEPERIODLASTYEAR(DATESYTD(Kalender[Date])))&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 23 Mar 2022 16:37:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PY-YTD-function-is-not-working/m-p/2413007#M63639</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-03-23T16:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: PY YTD function is not working</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PY-YTD-function-is-not-working/m-p/2414314#M63711</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240987" data-lia-user-login="johnt75" class="lia-mention lia-mention-user"&gt;johnt75&lt;/a&gt;&amp;nbsp;thanks for the help, however this returns the full year unfortunately.&lt;BR /&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;maybe I am misunderstanding but this returns "blank" while i know there is data LY YTD.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any other suggestions?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 07:46:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PY-YTD-function-is-not-working/m-p/2414314#M63711</guid>
      <dc:creator>stino123</dc:creator>
      <dc:date>2022-03-24T07:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: PY YTD function is not working</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PY-YTD-function-is-not-working/m-p/2422760#M64266</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="340844" data-lia-user-login="stino123" class="lia-mention lia-mention-user"&gt;stino123&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I created some data:&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;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
CALCULATE(
    SUM('Table'[amount]),
FILTER(ALL('Table'),
'Table'[date]&amp;gt;=DATE(YEAR(MAX('Table'[date]))-1,1,1)&amp;amp;&amp;amp;
'Table'[date]&amp;lt;=DATE(YEAR(MAX('Table'[date]))-1,MONTH(MAX('Table'[date])),DAY(MAX('Table'[date])))))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If I have misunderstood your meaning, please provide your desired output and your pbix without privacy information.&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, 29 Mar 2022 01:17:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/PY-YTD-function-is-not-working/m-p/2422760#M64266</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-29T01:17:36Z</dc:date>
    </item>
  </channel>
</rss>

