<?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: Average purchase price from 2023 in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-purchase-price-from-2023/m-p/3713375#M144499</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="626429" data-lia-user-login="RaMiRo87" class="lia-mention lia-mention-user"&gt;RaMiRo87&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your description, here are my steps you can follow as a solution.&lt;/P&gt;
&lt;P&gt;(1) My test data is the same as yours.&lt;/P&gt;
&lt;P&gt;(2) We can create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Average Purchase Price (Accounting) 2023 = 
IF(YEAR(MAX('Purchase Price'[CreatedOn]))=2023,CALCULATE(AVERAGE('Purchase Price'[Purchase Price (Accounting) Inventory]),YEAR('Purchase Price'[CreatedOn]) = 2023),BLANK())&lt;/LI-CODE&gt;
&lt;P&gt;(3)Or we can create a calculated column.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;_Average Purchase Price (Accounting) 2023 =
IF (
    YEAR ( 'Purchase Price'[CreatedOn] ) = 2023,
    CALCULATE (
        AVERAGE ( 'Purchase Price'[Purchase Price (Accounting) Inventory] ),
        FILTER ( 'Purchase Price', YEAR ( 'Purchase Price'[CreatedOn] ) = 2023 )
    ),
    BLANK ()
)
&lt;/LI-CODE&gt;
&lt;P&gt;(4) Then the result is as follows.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post  &lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution &lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Feb 2024 07:05:53 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-02-21T07:05:53Z</dc:date>
    <item>
      <title>Average purchase price from 2023</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-purchase-price-from-2023/m-p/3711379#M144402</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been searching the forum for my topic but haven't found anything related to my recent problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data table named 'Purchase Price'. Here I'm calclulating different KPIs, for example the average of the purchase price for the fiscal year 2023 for every product. For this I'm using the column [Purchase Price (Accounting) Inventory], the date column [CreatedOn] as well as the column for the product or item nr. [ItemId]. I'll show you how it looks like and give you a simplified example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ItemId&lt;/TD&gt;&lt;TD&gt;CreatedOn&lt;/TD&gt;&lt;TD&gt;Purchase Price (Accounting) Inventory&lt;/TD&gt;&lt;TD&gt;Average Purchase Price (Accounting) 2023&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1234&lt;/TD&gt;&lt;TD&gt;12.05.2022&lt;/TD&gt;&lt;TD&gt;70&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1234&lt;/TD&gt;&lt;TD&gt;01.12.2023&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1234&lt;/TD&gt;&lt;TD&gt;09.10.2023&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The last two of the three records should be considered for calclulating the average because they are booked in 2023.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The column [Average Purchase Price (Accounting) 2023] is my desired solution but I would be glad about any working solution to be honest.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if you need any other information or detail of the data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance! Ramirez&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 14:40:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-purchase-price-from-2023/m-p/3711379#M144402</guid>
      <dc:creator>RaMiRo87</dc:creator>
      <dc:date>2024-02-20T14:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: Average purchase price from 2023</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-purchase-price-from-2023/m-p/3711697#M144412</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="626429" data-lia-user-login="RaMiRo87" class="lia-mention lia-mention-user"&gt;RaMiRo87&lt;/a&gt;&amp;nbsp;, You can create a measure for this using&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Average Purchase Price (Accounting) 2023 =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;AVERAGE('Purchase Price'[Purchase Price (Accounting) Inventory]),&lt;BR /&gt;YEAR('Purchase Price'[CreatedOn]) = 2023&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please accept as solution and give kudos if it helps&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 16:22:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-purchase-price-from-2023/m-p/3711697#M144412</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2024-02-20T16:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: Average purchase price from 2023</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-purchase-price-from-2023/m-p/3713375#M144499</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="626429" data-lia-user-login="RaMiRo87" class="lia-mention lia-mention-user"&gt;RaMiRo87&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your description, here are my steps you can follow as a solution.&lt;/P&gt;
&lt;P&gt;(1) My test data is the same as yours.&lt;/P&gt;
&lt;P&gt;(2) We can create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Average Purchase Price (Accounting) 2023 = 
IF(YEAR(MAX('Purchase Price'[CreatedOn]))=2023,CALCULATE(AVERAGE('Purchase Price'[Purchase Price (Accounting) Inventory]),YEAR('Purchase Price'[CreatedOn]) = 2023),BLANK())&lt;/LI-CODE&gt;
&lt;P&gt;(3)Or we can create a calculated column.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;_Average Purchase Price (Accounting) 2023 =
IF (
    YEAR ( 'Purchase Price'[CreatedOn] ) = 2023,
    CALCULATE (
        AVERAGE ( 'Purchase Price'[Purchase Price (Accounting) Inventory] ),
        FILTER ( 'Purchase Price', YEAR ( 'Purchase Price'[CreatedOn] ) = 2023 )
    ),
    BLANK ()
)
&lt;/LI-CODE&gt;
&lt;P&gt;(4) Then the result is as follows.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post  &lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution &lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 07:05:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-purchase-price-from-2023/m-p/3713375#M144499</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-21T07:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Average purchase price from 2023</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-purchase-price-from-2023/m-p/3713628#M144510</link>
      <description>&lt;P&gt;Thank you very much for your well structured solution! Got everything I needed and my own Measure that I've prepared before posting this comes close. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and kind regards&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 08:48:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-purchase-price-from-2023/m-p/3713628#M144510</guid>
      <dc:creator>RaMiRo87</dc:creator>
      <dc:date>2024-02-21T08:48:37Z</dc:date>
    </item>
  </channel>
</rss>

