<?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 Dax YTD Calculation over multiple years in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-YTD-Calculation-over-multiple-years/m-p/2743336#M84395</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have a problem with a dax formula and i hope you can help me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to have a line chart which displays ytd sales for the last 4 years, based on a slicer where i want to select a month up to which the ytd value should be calculated to. Meaning when i select the month 06 for 2021 i want to have in the y axis of the line chart the following values:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for 2021 --&amp;gt; the ytd sales value for 2021 until the month 06&amp;nbsp;&lt;/P&gt;&lt;P&gt;for 2020 --&amp;gt;the ytd sales value for 2020 until the month 06&lt;/P&gt;&lt;P&gt;for 2019 --&amp;gt;the ytd sales value for 2019 until the month 06&lt;/P&gt;&lt;P&gt;for 2018 --&amp;gt;the ytd sales value for 2018 until the month 06&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the x axis i would then drop the year from my calendar do display the evolution of the ytd sales.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help and KR,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;</description>
    <pubDate>Fri, 02 Sep 2022 11:05:45 GMT</pubDate>
    <dc:creator>trying</dc:creator>
    <dc:date>2022-09-02T11:05:45Z</dc:date>
    <item>
      <title>Dax YTD Calculation over multiple years</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-YTD-Calculation-over-multiple-years/m-p/2743336#M84395</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have a problem with a dax formula and i hope you can help me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to have a line chart which displays ytd sales for the last 4 years, based on a slicer where i want to select a month up to which the ytd value should be calculated to. Meaning when i select the month 06 for 2021 i want to have in the y axis of the line chart the following values:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for 2021 --&amp;gt; the ytd sales value for 2021 until the month 06&amp;nbsp;&lt;/P&gt;&lt;P&gt;for 2020 --&amp;gt;the ytd sales value for 2020 until the month 06&lt;/P&gt;&lt;P&gt;for 2019 --&amp;gt;the ytd sales value for 2019 until the month 06&lt;/P&gt;&lt;P&gt;for 2018 --&amp;gt;the ytd sales value for 2018 until the month 06&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the x axis i would then drop the year from my calendar do display the evolution of the ytd sales.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help and KR,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 11:05:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-YTD-Calculation-over-multiple-years/m-p/2743336#M84395</guid>
      <dc:creator>trying</dc:creator>
      <dc:date>2022-09-02T11:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: Dax YTD Calculation over multiple years</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-YTD-Calculation-over-multiple-years/m-p/2743682#M84435</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Here is one way to do this:&lt;BR /&gt;Data:&lt;/P&g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V&gt;&lt;SPAN&gt;Measure 21 = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[Measure 20]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;SAMEPERIODLASTYEAR&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Calendar'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;The idea is to user SAMEPERIODLASTYEAR for each additional year you want to see to past.&lt;BR /&gt;&lt;BR /&gt;End result:&lt;/DIV&gt;
&lt;DIV&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&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;BR /&gt;&lt;BR /&gt;My LinkedIn: &lt;A href="https://www.linkedin.com/in/n%C3%A4ttiahov-00001/" target="_blank"&gt;https://www.linkedin.com/in/n%C3%A4ttiahov-00001/&lt;/A&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 13:24:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-YTD-Calculation-over-multiple-years/m-p/2743682#M84435</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2022-09-02T13:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Dax YTD Calculation over multiple years</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-YTD-Calculation-over-multiple-years/m-p/2743860#M84458</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;first off all thanks for the reply and your effort!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately this wont solve my issue. I wanted to have one single measure that can do the trick. Is this possible?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 14:56:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-YTD-Calculation-over-multiple-years/m-p/2743860#M84458</guid>
      <dc:creator>trying</dc:creator>
      <dc:date>2022-09-02T14:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: Dax YTD Calculation over multiple years</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-YTD-Calculation-over-multiple-years/m-p/2749635#M84794</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="363804" data-lia-user-login="trying" class="lia-mention lia-mention-user"&gt;trying&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this you want?&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If yes, you need create a measure like the following:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
VAR _ytddate =
    FILTER ( ALLSELECTED ( 'Table' ), [Date].[MonthNo] &amp;lt;= MAX ( 'Month'[index] ) )
VAR _ytddate_c =
    FILTER (
        _ytddate,
        [Date] &amp;lt;= MAX ( 'Table'[Date] )
            &amp;amp;&amp;amp; [Date].[Year] = MAX ( 'Table'[Date].[Year] )
    )
RETURN
    IF (
        SELECTEDVALUE ( 'Month'[index] ) &amp;lt; MAX ( 'Table'[Date].[MonthNo] ),
        BLANK (),
        SUMX ( _ytddate_c, [Value] )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Pbix in the end you can refer.&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ chenwu zhu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 08:06:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-YTD-Calculation-over-multiple-years/m-p/2749635#M84794</guid>
      <dc:creator>v-chenwuz-msft</dc:creator>
      <dc:date>2022-09-06T08:06:53Z</dc:date>
    </item>
  </channel>
</rss>

