<?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 Calculating YTD Sales using a Variable in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-YTD-Sales-using-a-Variable/m-p/1090386#M15746</link>
    <description>&lt;P&gt;Good afternoon, Team,&lt;BR /&gt;&lt;BR /&gt;I'm trying to do what should be a very simple thing.&amp;nbsp; Use variables in a CALCULATE for DATESYTD, and when I add it to a visual, it just shows the sum by row.&lt;BR /&gt;&lt;BR /&gt;My DAX is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;YTD Sales = VAR Sales = SUM([Sale AMT])&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; VAR Dates = DATESYTD('Calendar'[Date])&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; VAR Results = CALCULATE(Sales, Dates)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Return Results&lt;BR /&gt;&lt;BR /&gt;I have created a date table, and it is both marked as the date table and related properly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone let me know what I'm doing wrong, or why this isn't returning YTD summarizations?&amp;nbsp; Thanks!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 14 May 2020 21:04:58 GMT</pubDate>
    <dc:creator>RodgerB</dc:creator>
    <dc:date>2020-05-14T21:04:58Z</dc:date>
    <item>
      <title>Calculating YTD Sales using a Variable</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-YTD-Sales-using-a-Variable/m-p/1090386#M15746</link>
      <description>&lt;P&gt;Good afternoon, Team,&lt;BR /&gt;&lt;BR /&gt;I'm trying to do what should be a very simple thing.&amp;nbsp; Use variables in a CALCULATE for DATESYTD, and when I add it to a visual, it just shows the sum by row.&lt;BR /&gt;&lt;BR /&gt;My DAX is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;YTD Sales = VAR Sales = SUM([Sale AMT])&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; VAR Dates = DATESYTD('Calendar'[Date])&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; VAR Results = CALCULATE(Sales, Dates)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Return Results&lt;BR /&gt;&lt;BR /&gt;I have created a date table, and it is both marked as the date table and related properly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone let me know what I'm doing wrong, or why this isn't returning YTD summarizations?&amp;nbsp; Thanks!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 21:04:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-YTD-Sales-using-a-Variable/m-p/1090386#M15746</guid>
      <dc:creator>RodgerB</dc:creator>
      <dc:date>2020-05-14T21:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating YTD Sales using a Variable</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-YTD-Sales-using-a-Variable/m-p/1090501#M15753</link>
      <description>&lt;P&gt;You should not calculate your expression first as a variable.&amp;nbsp; The way it is writtten, it is first doing the sum in the current context and then passing that as a fixed value into the Calculate() part.&amp;nbsp; Try this instead:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;YTD Sales =&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE(SUM(Table[Sale AMT]), DATESYTD('Calendar'[Date']) //replace Table with the name of your table&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This assumes you are using columns from your 'Date' table in your visual.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this works for you, please mark it as the solution.&amp;nbsp; Kudos are appreciated too.&amp;nbsp; Please let me know if not.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pat&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 00:16:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-YTD-Sales-using-a-Variable/m-p/1090501#M15753</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2020-05-15T00:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating YTD Sales using a Variable</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-YTD-Sales-using-a-Variable/m-p/1090557#M15756</link>
      <description>&lt;P&gt;Good evening, Pat,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am well versed on YTD using CALCULATE and DATESYTD, as well as using DATEADD to get the previous year.&amp;nbsp; As I'm trying to work with VAR and RESULT now, I was just hoping to use them to make the syntax for YTD sales easier to read for my end users.&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;&lt;P&gt;Rodger&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="226208" data-lia-user-login="mahoneypat" class="lia-mention lia-mention-user"&gt;mahoneypat&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 01:34:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-YTD-Sales-using-a-Variable/m-p/1090557#M15756</guid>
      <dc:creator>RodgerB</dc:creator>
      <dc:date>2020-05-15T01:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating YTD Sales using a Variable</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-YTD-Sales-using-a-Variable/m-p/3431000#M130085</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="39327" data-lia-user-login="RodgerB" class="lia-mention lia-mention-user"&gt;RodgerB&lt;/a&gt;&amp;nbsp;You did it? I have the same problem&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 12:49:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-YTD-Sales-using-a-Variable/m-p/3431000#M130085</guid>
      <dc:creator>Pedro_Crani</dc:creator>
      <dc:date>2023-09-14T12:49:22Z</dc:date>
    </item>
  </channel>
</rss>

