<?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: Between lastyear and same date of lastdate of this year in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2674976#M79882</link>
    <description>&lt;P&gt;Oh sorry i just find a new problem with this DAX command.&lt;/P&gt;&lt;P&gt;That's correct for the current year but i try this :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Ingenie - n-1 (total ventes) = 
VAR endDate =
    LASTDATE ( Ingenie[Date réservation] )
RETURN
    CALCULATE (
        SUM(Ingenie[Prix total TTC Prestation (Vente)]),
        PARALLELPERIOD(
            DATESBETWEEN (
                Ingenie[Date réservation],
                DATE ( YEAR ( TODAY () ), 1, 1 ),
                DATE ( YEAR ( 'endDate' ), MONTH ( 'endDate' ), DAY ( 'endDate' ) )
            )
        , -12, MONTH )
    )&lt;/LI-CODE&gt;&lt;P&gt;Try -1 Year and also SAMEPERIODLASTYEAR function but i identify this bug :&lt;/P&gt;&lt;P&gt;If the day in endDate variable is "2022-08-01" the function return amout of all the last year month of august, as if i had writen "2021-08-31".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you ever encountered this problem?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 02 Aug 2022 08:49:26 GMT</pubDate>
    <dc:creator>Lexarino</dc:creator>
    <dc:date>2022-08-02T08:49:26Z</dc:date>
    <item>
      <title>Between lastyear and same date of lastdate of this year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2483317#M68074</link>
      <description>&lt;P&gt;Hello !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try to compare data range from begining of last year and the day of last data update, but replace this day to last year.&lt;BR /&gt;But don't know where and how specify last year paramater in my DAX command :&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;= &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DATESBETWEEN&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Calendar[Date]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;DATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;YEAR(TODAY()-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;1&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;LASTDATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;EcoVisio[Date]&lt;/SPAN&gt;&lt;SPAN&gt;) - 1 year !&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;LASTDATE(EcoVisio[Date]) as this format "2022-04-28" and would like "2021-04-28".&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks you for your help !&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 28 Apr 2022 13:06:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2483317#M68074</guid>
      <dc:creator>Lexarino</dc:creator>
      <dc:date>2022-04-28T13:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: Between lastyear and same date of lastdate of this year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2483381#M68079</link>
      <description>&lt;LI-CODE lang="markup"&gt;var endDate = LASTDATE(EcoVisio[Date])
return DATESBETWEEN( 'Calendar'[Date], DATE( YEAR(TODAY())-1, 1, 1), DATE( YEAR(endDate) - 1, MONTH(endDate), DAY(endDate)))&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 28 Apr 2022 13:15:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2483381#M68079</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-04-28T13:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: Between lastyear and same date of lastdate of this year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2483441#M68092</link>
      <description>&lt;P&gt;Seems to be the perfect solution but don't find the correct syntax to integrate it &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;EcoVisio[BIT Arzon]&lt;/SPAN&gt;&lt;SPAN&gt;) + &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;EcoVisio[BIT Vannes]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DI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SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;DAY&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'endDate'&lt;/SPAN&gt;&lt;SPAN&gt;)))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm such a looser in DAX !!&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 28 Apr 2022 13:31:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2483441#M68092</guid>
      <dc:creator>Lexarino</dc:creator>
      <dc:date>2022-04-28T13:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Between lastyear and same date of lastdate of this year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2483454#M68094</link>
      <description>&lt;LI-CODE lang="markup"&gt;My Measure =
VAR endDate =
    LASTDATE ( EcoVisio[Date] )
RETURN
    CALCULATE (
        SUM ( EcoVisio[BIT Arzon] ) + SUM ( EcoVisio[BIT Vannes] ),
        DATESBETWEEN (
            Ecovisio[Date],
            DATE ( YEAR ( TODAY () ) - 1, 1, 1 ),
            DATE ( YEAR ( 'endDate' ) - 1, MONTH ( 'endDate' ), DAY ( 'endDate' ) )
        )
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 28 Apr 2022 13:34:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2483454#M68094</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-04-28T13:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: Between lastyear and same date of lastdate of this year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2483456#M68095</link>
      <description>&lt;P&gt;Seems to be the perfect solution but don't find the correct syntax to integrate it &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;CALCULATE(SUM(EcoVisio[BIT Arzon]) + SUM(EcoVisio[BIT Vannes]),&lt;BR /&gt;var endDate = LASTDATE(EcoVisio[Date])&lt;BR /&gt;return&lt;BR /&gt;DATESBETWEEN(Ecovisio[Date], DATE(YEAR(TODAY())-1, 1, 1), DATE(YEAR('endDate') - 1, MONTH('endDate'), DAY('endDate')))&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;I'm such a looser in DAX !!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 13:34:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2483456#M68095</guid>
      <dc:creator>Lexarino</dc:creator>
      <dc:date>2022-04-28T13:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: Between lastyear and same date of lastdate of this year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2483471#M68096</link>
      <description>&lt;P&gt;OMG &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; That's perfect !&lt;BR /&gt;And now i know how to construct variable in DAX.&lt;/P&gt;&lt;P&gt;I'm a PHP, JQuery, MySQL developper but every language has its subtleties !&lt;BR /&gt;&lt;BR /&gt;Thanks a lot&amp;nbsp;&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;!&lt;BR /&gt;A view of the result :&amp;nbsp;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 13:40:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2483471#M68096</guid>
      <dc:creator>Lexarino</dc:creator>
      <dc:date>2022-04-28T13:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Between lastyear and same date of lastdate of this year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2674976#M79882</link>
      <description>&lt;P&gt;Oh sorry i just find a new problem with this DAX command.&lt;/P&gt;&lt;P&gt;That's correct for the current year but i try this :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Ingenie - n-1 (total ventes) = 
VAR endDate =
    LASTDATE ( Ingenie[Date réservation] )
RETURN
    CALCULATE (
        SUM(Ingenie[Prix total TTC Prestation (Vente)]),
        PARALLELPERIOD(
            DATESBETWEEN (
                Ingenie[Date réservation],
                DATE ( YEAR ( TODAY () ), 1, 1 ),
                DATE ( YEAR ( 'endDate' ), MONTH ( 'endDate' ), DAY ( 'endDate' ) )
            )
        , -12, MONTH )
    )&lt;/LI-CODE&gt;&lt;P&gt;Try -1 Year and also SAMEPERIODLASTYEAR function but i identify this bug :&lt;/P&gt;&lt;P&gt;If the day in endDate variable is "2022-08-01" the function return amout of all the last year month of august, as if i had writen "2021-08-31".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you ever encountered this problem?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 08:49:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2674976#M79882</guid>
      <dc:creator>Lexarino</dc:creator>
      <dc:date>2022-08-02T08:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Between lastyear and same date of lastdate of this year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2675003#M79885</link>
      <description>&lt;P&gt;That's expected behaviour for PARALLELPERIOD, it automatically fills out any partial months. Try SAMEPERIODLASTYEAR instead&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 08:54:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2675003#M79885</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-08-02T08:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: Between lastyear and same date of lastdate of this year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2675045#M79887</link>
      <description>&lt;P&gt;I try this :&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    CALCULATE (
        SUM(Ingenie[Prix total TTC Prestation (Vente)]),
        SAMEPERIODLASTYEAR(
            DATESBETWEEN (
                Ingenie[Date réservation],
                DATE ( 2022, 1, 1 ),
                DATE ( 2022, 08, 01 )
            )
        )
    )&lt;/LI-CODE&gt;&lt;P&gt;Always the same problem, it accumulates the whole month of August of last year.&lt;BR /&gt;Not the same amount when i calculate directly 2021-1-1 to 2021-8-1&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 09:08:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2675045#M79887</guid>
      <dc:creator>Lexarino</dc:creator>
      <dc:date>2022-08-02T09:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: Between lastyear and same date of lastdate of this year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2675062#M79888</link>
      <description>&lt;P&gt;Try running the below in DAX Studio&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;EVALUATE
SAMEPERIODLASTYEAR(
            DATESBETWEEN (
                Ingenie[Date réservation],
                DATE ( 2022, 1, 1 ),
                DATE ( 2022, 08, 01 )
            )
        )
ORDER BY Ingenie[Date réservation] DESC&lt;/LI-CODE&gt;&lt;P&gt;and see what dates are returned. The problem could be that you are not using a proper Date table but are using the dates from your fact table, as when I run the above I get the correct dates ending with 1 August 2021&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 09:17:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2675062#M79888</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-08-02T09:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: Between lastyear and same date of lastdate of this year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2675549#M79924</link>
      <description>&lt;P&gt;Ohh thanks a lot !&lt;BR /&gt;You are right, in the DATESBETWEEN function I was referring to the calendar of the current table and not my reference calendar with unique date &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; So stupid !&lt;BR /&gt;And as you said also, PARALLELPERIOD apply to all month.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;So now i have the correct DAX :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR endDate =
    LASTDATE ( Ingenie[Date réservation] ) // Here the table calendar with data
RETURN
    CALCULATE (
        SUM(Ingenie[Prix total TTC Prestation (Vente)]),
        SAMEPERIODLASTYEAR(
            DATESBETWEEN (
                Calendrier[Date], // Here the calendar with unique date
                DATE ( YEAR ( 'endDate' ), 1, 1 ),
                DATE ( YEAR ( 'endDate' ), MONTH ( 'endDate' ), DAY ( 'endDate' ) )
            )
        )
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 02 Aug 2022 12:25:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Between-lastyear-and-same-date-of-lastdate-of-this-year/m-p/2675549#M79924</guid>
      <dc:creator>Lexarino</dc:creator>
      <dc:date>2022-08-02T12:25:17Z</dc:date>
    </item>
  </channel>
</rss>

