<?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 show correct YTD values in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-correct-YTD-values/m-p/2484399#M68148</link>
    <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;Thank you for the good words. The measures would always (unless you play with visual interactions) provide just one value based on your date slicer. So if you are looking at YTD or LY YTD and your date slicer is on 3-31-2022 - your answers will be that YTD values as of 3-31-2022.&lt;/P&gt;&lt;P&gt;I hope that answers your question. Thanks again..&lt;/P&gt;</description>
    <pubDate>Fri, 29 Apr 2022 00:48:24 GMT</pubDate>
    <dc:creator>Whitewater100</dc:creator>
    <dc:date>2022-04-29T00:48:24Z</dc:date>
    <item>
      <title>How to show correct YTD values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-correct-YTD-values/m-p/2481610#M67950</link>
      <description>&lt;P&gt;Hello all, I could use some help with getting this DAX to work as expected. What I'm trying to do is simple - return the values from the prior year-to-date. So the most recent month I have in the data is March 2022. I would expect the&amp;nbsp;current YTD to be Jan+Feb+Mar 2022, just as the prior YTD would be Jan+Feb+Mar 2021. No matter what I do, may DAX is either returning numbers that I have no idea where its coming from, or a single&amp;nbsp;accurate value for all months, but this doesn't work when I try to use a slicer to choose a different time period, because its the same number.&amp;nbsp;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;What also might be complicating this is I'm attempting to display this single value in a card visual. PBI seems to be giving me either a single value that will not change or the grand total value of the entire previous year.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Here is an example of the full list of numbers that I would expect it to be:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;(Note, this is based off a formula, not an average)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So if I focus purely on Jan-Mar:&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I would expect the Prior YTD to be 16.6%.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem #1 Accurate value but slicers don't affect it:&amp;nbsp;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;No matter what date/month I choose here, it returns the 16.6%, which is accurate only for a single month (the Jan+Feb+Mar timeline). Here is the code that I used to generate this: (sorry, but PBI really doesn't like my DAX code inside the code sample)&lt;/P&gt;&lt;DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VAR prevDate =&lt;BR /&gt;MAXX (&lt;BR /&gt;ALL ( Date_Continuous[Date] ),&lt;BR /&gt;DATEADD ( Date_Continuous[Date], -1, YEAR )&lt;BR /&gt;)&lt;BR /&gt;VAR prevEnd =&lt;BR /&gt;EOMONTH ( prevDate, 0 )&lt;BR /&gt;VAR prevStart =&lt;BR /&gt;DATE ( YEAR ( prevDate ), 1, 1 )&lt;BR /&gt;&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE (&lt;BR /&gt;DIVIDE (&lt;BR /&gt;SUM ( Numerator ),&lt;BR /&gt;SUM ( Denominator )&lt;BR /&gt;),&lt;BR /&gt;Date_Continuous[Date] &amp;gt;= prevStart&lt;BR /&gt;&amp;amp;&amp;amp; Date_Continuous[Date] &amp;lt;= prevEnd&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem #2 value that changes with slicers but is innaccurate:&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;This method changes the value when I select different months, but the 8.6% value is not accurate. I have no idea where it is coming from! Here is the code for this measure:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;CALCULATE (DIVIDE ( SUM ( Numerator ), SUM ( Denominator ) ), DATESYTD ( DATEADD ( Date_Continuous[Date], -1, YEAR ) ) )&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I played around with the -1 which is the number of intervals, but I just can't get it to work. I feel that I'm close with this method though!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 27 Apr 2022 23:06:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-correct-YTD-values/m-p/2481610#M67950</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-27T23:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to show correct YTD values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-correct-YTD-values/m-p/2481676#M67951</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;I built out an example for you including YTD &amp;amp; PYTD on both a interger field and a percentage field. Using a nice Date Table can help alot. You can see how the measures build upon eachother (branching). I hope this can be a solution for you.&lt;/P&gt;&lt;P&gt;&lt;A title="YTD PYD " href="https://drive.google.com/file/d/1uNb3cBh4l89_EtPAZpjZayYAH2WbtNfJ/view?usp=sharing" target="_self"&gt;https://drive.google.com/file/d/1uNb3cBh4l89_EtPAZpjZayYAH2WbtNfJ/view?usp=sharing&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will paste a couple measure below, all are in this file.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;STRONG&gt;YTD Profit Margin %&lt;/STRONG&gt; = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;toYTDprofit&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;[YTD Sales]&lt;/SPAN&gt;&lt;SPAN&gt; - &lt;/SPAN&gt;&lt;SPAN&gt;[YTD Cost]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;STRONG&gt;Prior YTD Profit Margin %&lt;/STRONG&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[YTD Profit Margin %]&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;Dates[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;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DIVIDE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;toYTDprofit&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;[YTD Sales]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DAX has more than one way to do this. Usually either DATEADD or SAMEPERIODLASTYEAR are good function to help with prior year views.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 28 Apr 2022 00:43:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-correct-YTD-values/m-p/2481676#M67951</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-04-28T00:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to show correct YTD values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-correct-YTD-values/m-p/2483657#M68114</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="179903" data-lia-user-login="Whitewater100" class="lia-mention lia-mention-user"&gt;Whitewater100&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Thank you! Your file was very helpful&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 14:50:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-correct-YTD-values/m-p/2483657#M68114</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-28T14:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to show correct YTD values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-correct-YTD-values/m-p/2484269#M68145</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="179903" data-lia-user-login="Whitewater100" class="lia-mention lia-mention-user"&gt;Whitewater100&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;One more question related to this. Is there a known problem with moving measures from a table visual into a card visual? For example, from your .pbix file -&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;My expectation here is that the 55.4% would be in the card and the 2022 Prior YTD Proft Margin % colummn.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 21:56:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-correct-YTD-values/m-p/2484269#M68145</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-28T21:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to show correct YTD values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-correct-YTD-values/m-p/2484399#M68148</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;Thank you for the good words. The measures would always (unless you play with visual interactions) provide just one value based on your date slicer. So if you are looking at YTD or LY YTD and your date slicer is on 3-31-2022 - your answers will be that YTD values as of 3-31-2022.&lt;/P&gt;&lt;P&gt;I hope that answers your question. Thanks again..&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 00:48:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-show-correct-YTD-values/m-p/2484399#M68148</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-04-29T00:48:24Z</dc:date>
    </item>
  </channel>
</rss>

