<?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: DAX formula for previous year (numbers not in date format) in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-previous-year-numbers-not-in-date-format/m-p/3661535#M141889</link>
    <description>&lt;P&gt;Please provide sample data that covers your issue or question &lt;STRONG&gt;completely&lt;/STRONG&gt;, in a &lt;STRONG&gt;usable&lt;/STRONG&gt; format (not as a screenshot).&lt;BR /&gt;&lt;BR /&gt;Do not include sensitive information or anything not related to the issue or question. &lt;BR /&gt;&lt;BR /&gt;If you are unsure how to upload data please refer to &lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;Please show the expected outcome based on the sample data you provided. &lt;BR /&gt;&lt;BR /&gt;Want faster answers? &lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jan 2024 22:32:33 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2024-01-25T22:32:33Z</dc:date>
    <item>
      <title>DAX formula for previous year (numbers not in date format)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-previous-year-numbers-not-in-date-format/m-p/3660558#M141841</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to Power Bi and DAX writting, so please help me.&lt;/P&gt;&lt;P&gt;I want to create a simple formula (or I though it was simple), where the amount I see should be the previous year total amount. Example: if year is 2020, the number I see should be 2019 result.&lt;/P&gt;&lt;P&gt;I tried with the following formula:&lt;/P&gt;&lt;P&gt;Y-1 = CALCULATE([Total],Mapping_Year[Year]-1)&lt;/P&gt;&lt;P&gt;but the result is just the total for the respective year (not the previous year), see picture below:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I fix the formula? Also, my [Year] information is stored as number (not as date), so the DATEADD formula doesn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2024 13:30:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-previous-year-numbers-not-in-date-format/m-p/3660558#M141841</guid>
      <dc:creator>Mendy_4580</dc:creator>
      <dc:date>2024-01-25T13:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for previous year (numbers not in date format)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-previous-year-numbers-not-in-date-format/m-p/3661535#M141889</link>
      <description>&lt;P&gt;Please provide sample data that covers your issue or question &lt;STRONG&gt;completely&lt;/STRONG&gt;, in a &lt;STRONG&gt;usable&lt;/STRONG&gt; format (not as a screenshot).&lt;BR /&gt;&lt;BR /&gt;Do not include sensitive information or anything not related to the issue or question. &lt;BR /&gt;&lt;BR /&gt;If you are unsure how to upload data please refer to &lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;Please show the expected outcome based on the sample data you provided. &lt;BR /&gt;&lt;BR /&gt;Want faster answers? &lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2024 22:32:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-previous-year-numbers-not-in-date-format/m-p/3661535#M141889</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-01-25T22:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula for previous year (numbers not in date format)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-previous-year-numbers-not-in-date-format/m-p/3662280#M141917</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="680303" data-lia-user-login="Mendy_4580" class="lia-mention lia-mention-user"&gt;Mendy_4580&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe you can try this:&lt;/P&gt;
&lt;P&gt;I create a set of sample data and a matrix:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then create a measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
    VAR _currentdate = MAX('Table (2)'[date])
//get the current date of this row in the matrix
    VAR _Previousdate = CALCULATE(
        MAX('Table (2)'[date]),
        FILTER(
            ALLSELECTED('Table (2)'),
            'Table (2)'[date] &amp;lt; _currentdate
        )
    )
//get the date of previous row in the matrix
    RETURN
        CALCULATE(
            SUM('Table (2)'[value]),
            FILTER(
                ALLSELECTED('Table (2)'),
                'Table (2)'[date] = _Previousdate
            )
        )
//get the value sum of the previous date&lt;/LI-CODE&gt;
&lt;P&gt;The result is as follow:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Zhengdong Xu&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2024 08:36:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-for-previous-year-numbers-not-in-date-format/m-p/3662280#M141917</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-26T08:36:47Z</dc:date>
    </item>
  </channel>
</rss>

