<?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 How to calculate a measure based based of calculation on previous year in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-measure-based-based-of-calculation-on/m-p/2323641#M58101</link>
    <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;I would like to calculate the Price gap between current year and previous year.&lt;/P&gt;&lt;P&gt;Price GAP Formula is&amp;nbsp; : (Product cost (Y) * Qty (Y)) - (Product cost (Y-1) * Qty (Y))&lt;/P&gt;&lt;P&gt;and Product cost formula is : Purchase Amount / Qty&amp;nbsp;&lt;/P&gt;&lt;P&gt;the detail of information is at order level, but the product cost should calculated at Item, Purchaser level and after agregated&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there formula dax to calculate this measure?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Feb 2022 16:54:31 GMT</pubDate>
    <dc:creator>davidtanchon</dc:creator>
    <dc:date>2022-02-07T16:54:31Z</dc:date>
    <item>
      <title>How to calculate a measure based based of calculation on previous year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-measure-based-based-of-calculation-on/m-p/2323641#M58101</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;I would like to calculate the Price gap between current year and previous year.&lt;/P&gt;&lt;P&gt;Price GAP Formula is&amp;nbsp; : (Product cost (Y) * Qty (Y)) - (Product cost (Y-1) * Qty (Y))&lt;/P&gt;&lt;P&gt;and Product cost formula is : Purchase Amount / Qty&amp;nbsp;&lt;/P&gt;&lt;P&gt;the detail of information is at order level, but the product cost should calculated at Item, Purchaser level and after agregated&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there formula dax to calculate this measure?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 16:54:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-measure-based-based-of-calculation-on/m-p/2323641#M58101</guid>
      <dc:creator>davidtanchon</dc:creator>
      <dc:date>2022-02-07T16:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a measure based based of calculation on previous year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-measure-based-based-of-calculation-on/m-p/2323675#M58105</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="344684" data-lia-user-login="davidtanchon" class="lia-mention lia-mention-user"&gt;davidtanchon&lt;/a&gt; , with help from date table and time intelligence you can create measures for this year and last year &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))&lt;BR /&gt;Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))&lt;BR /&gt;This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))&lt;BR /&gt;Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Power BI — Year on Year with or Without Time Intelligence &lt;BR /&gt;&lt;A href="https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a" target="_blank"&gt;https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.youtube.com/watch?v=km41KfM_0uA" target="_blank"&gt;https://www.youtube.com/watch?v=km41KfM_0uA&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 17:10:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-measure-based-based-of-calculation-on/m-p/2323675#M58105</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-02-07T17:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a measure based based of calculation on previous year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-measure-based-based-of-calculation-on/m-p/2323686#M58106</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="344684" data-lia-user-login="davidtanchon" class="lia-mention lia-mention-user"&gt;davidtanchon&lt;/a&gt;&amp;nbsp;- I think you are looking for formula the works out the ( Product Cost difference ) * Quantity within a SUMX.&amp;nbsp; I am going to assume that you Quantity is available for individual items on fact table, and the corresponding Current Year and Prior Year Price are on related product table:&lt;BR /&gt;&lt;BR /&gt;The formula would look something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Change in Product Cost = SUMX( fact , fact[Qty] * ( RELATED(Product[Current Cost] ) - RELATED(Product[Prior Year Cost]) )&lt;/PRE&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;Daryl&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 17:14:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-measure-based-based-of-calculation-on/m-p/2323686#M58106</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-07T17:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate a measure based based of calculation on previous year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-measure-based-based-of-calculation-on/m-p/2330605#M58543</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="344684" data-lia-user-login="davidtanchon" class="lia-mention lia-mention-user"&gt;davidtanchon&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Due to I don't know your data model, I build a sample to have a test.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Try this measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Price GAP Formula = 
VAR _CURRENTYEAR = SUM('Table'[Product cost])*SUM('Table'[QTY])
VAR _Previous = CALCULATE(SUM('Table'[Product cost])*SUM('Table'[QTY]),FILTER(ALL('Table'),'Table'[Product]=MAX('Table'[Product])&amp;amp;&amp;amp;'Table'[Year] = SUM('Table'[Year])-1))
RETURN
_CURRENTYEAR - _Previous&lt;/LI-CODE&gt;
&lt;P&gt;Result is as below.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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>Thu, 10 Feb 2022 10:08:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-a-measure-based-based-of-calculation-on/m-p/2330605#M58543</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-10T10:08:12Z</dc:date>
    </item>
  </channel>
</rss>

