<?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 Create a KPI target based on the previous year value in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-KPI-target-based-on-the-previous-year-value/m-p/3688971#M143333</link>
    <description>&lt;P&gt;For example, if I have 10000 items sold in 2022, and if I want my target in 2023, I must do : 10000 * 1.8.&lt;/P&gt;&lt;P&gt;I have: table1[items], table1[date]&lt;BR /&gt;&amp;nbsp;items date&lt;/P&gt;&lt;P&gt;&amp;nbsp;car &amp;nbsp; &amp;nbsp; 2022/06/19&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;table &amp;nbsp;2023/10/11&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;car &amp;nbsp; &amp;nbsp;&amp;nbsp;2022/06/13&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;house&amp;nbsp;2023/02/11&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Mar 2024 14:28:36 GMT</pubDate>
    <dc:creator>game1</dc:creator>
    <dc:date>2024-03-01T14:28:36Z</dc:date>
    <item>
      <title>Create a KPI target based on the previous year value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-KPI-target-based-on-the-previous-year-value/m-p/3688971#M143333</link>
      <description>&lt;P&gt;For example, if I have 10000 items sold in 2022, and if I want my target in 2023, I must do : 10000 * 1.8.&lt;/P&gt;&lt;P&gt;I have: table1[items], table1[date]&lt;BR /&gt;&amp;nbsp;items date&lt;/P&gt;&lt;P&gt;&amp;nbsp;car &amp;nbsp; &amp;nbsp; 2022/06/19&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;table &amp;nbsp;2023/10/11&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;car &amp;nbsp; &amp;nbsp;&amp;nbsp;2022/06/13&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;house&amp;nbsp;2023/02/11&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2024 14:28:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-KPI-target-based-on-the-previous-year-value/m-p/3688971#M143333</guid>
      <dc:creator>game1</dc:creator>
      <dc:date>2024-03-01T14:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: Create a KPI target based on the previous year value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-KPI-target-based-on-the-previous-year-value/m-p/3689888#M143386</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="659758" data-lia-user-login="game1" class="lia-mention lia-mention-user"&gt;game1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;What's your expected result? Could you please provide more details base on your shared sample data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 03:45:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-KPI-target-based-on-the-previous-year-value/m-p/3689888#M143386</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-09T03:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: Create a KPI target based on the previous year value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-KPI-target-based-on-the-previous-year-value/m-p/3690109#M143392</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="659758" data-lia-user-login="game1" class="lia-mention lia-mention-user"&gt;game1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I created a sample pbix file(see&lt;EM&gt;&lt;STRONG&gt; the attachment)&lt;/STRONG&gt;&lt;/EM&gt;, please check if that is what you want.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Target = 
VAR _year =
    SELECTEDVALUE('Date'[Date].[Year] )
VAR _month =
    SELECTEDVALUE('Date'[Date].[MonthNo],12)
VAR _pycount =
    CALCULATE (
        COUNT ( 'Table'[items] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            YEAR ( 'Table'[date] ) = _year-1
                &amp;amp;&amp;amp; MONTH ( 'Table'[date] ) &amp;lt;= _month
        )
    )
RETURN
    _pycount * 1.8&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 06:34:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-KPI-target-based-on-the-previous-year-value/m-p/3690109#M143392</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-09T06:34:04Z</dc:date>
    </item>
    <item>
      <title>Re: Create a KPI target based on the previous year value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-KPI-target-based-on-the-previous-year-value/m-p/3692580#M143533</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is possible to do the same thing by using Table[date]? Because, what I need&amp;nbsp;&lt;SPAN&gt;is that if I select a year or month from Table[date], it must calculated my Target. &amp;nbsp;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2024 14:34:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-KPI-target-based-on-the-previous-year-value/m-p/3692580#M143533</guid>
      <dc:creator>game1</dc:creator>
      <dc:date>2024-03-01T14:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Create a KPI target based on the previous year value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-KPI-target-based-on-the-previous-year-value/m-p/3693636#M143594</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="659758" data-lia-user-login="game1" class="lia-mention lia-mention-user"&gt;game1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;When apply the date field of your fact table, it will &lt;STRONG&gt;only&lt;/STRONG&gt; display the data with the current selected month. Hence it will not return the expected result...&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;VAR _year =
    SELECTEDVALUE('Table'[Date].[Year] )
VAR _month =
    SELECTEDVALUE('Table'[Date].[MonthNo],12)&lt;/LI-CODE&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2024 08:52:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-KPI-target-based-on-the-previous-year-value/m-p/3693636#M143594</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-12T08:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: Create a KPI target based on the previous year value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-KPI-target-based-on-the-previous-year-value/m-p/3695424#M143704</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;It is only working for Year, not for Month. For example, I should have for october 2023, 1.8 x 1 = 1.8, because it should count the items of october, for the previous year. In october 2022, we have 1 item. So, the target for ocotber 2023, must be :&amp;nbsp;1.8 x 1 = 1.8. It I select only Year, it work perfectly, but month is not giving the good result. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 05:15:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-KPI-target-based-on-the-previous-year-value/m-p/3695424#M143704</guid>
      <dc:creator>game1</dc:creator>
      <dc:date>2024-02-13T05:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: Create a KPI target based on the previous year value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-KPI-target-based-on-the-previous-year-value/m-p/3707458#M144217</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="659758" data-lia-user-login="game1" class="lia-mention lia-mention-user"&gt;game1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I updated the sample pbix file, please find the details in the attachment.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Target = 
VAR _year =
    SELECTEDVALUE('Date'[Date].[Year] )
VAR _month =
    SELECTEDVALUE('Date'[Date].[MonthNo],12)
VAR _pycount =
    CALCULATE (
        COUNT ( 'Table'[items] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            YEAR ( 'Table'[date] ) = _year-1
                &amp;amp;&amp;amp;  IF(ISFILTERED('Date'[Date].[Month]),MONTH ( 'Table'[date] )  = _month,1=1)
        )
    )
RETURN
       _pycount  * 1.8&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 09:20:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Create-a-KPI-target-based-on-the-previous-year-value/m-p/3707458#M144217</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-19T09:20:10Z</dc:date>
    </item>
  </channel>
</rss>

