<?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: Subtract one column value to each column values in same row in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-one-column-value-to-each-column-values-in-same-row/m-p/3931723#M152968</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="707964" data-lia-user-login="ShyamS" class="lia-mention lia-mention-user"&gt;ShyamS&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can not help you very well by providing DAX syntax and data in the form of screenshots.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;For calculations involving this year and last year, it would be better to create a date table with all the dates in the main table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try syntax logic like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;MEASURE =
VAR _sameDayLastYear =
    DATE ( YEAR ( MAX ( 'Date'[Date] ) ) - 1, MONTH ( MAX ( 'Date'[Date] ) ), DAY ( MAX ( 'Date'[Date] ) ) )
VAR _lastYear =
    CALCULATE (
        SUM ( Table[ACTUAL] ),
        FILTER ( ALL ( 'Date' ), 'Date'[Year] = _sameDayLastYear )
    )
VAR _actual =
    SUM ( Table[ACTUAL] )
RETURN
    _lastYear - _actual&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please provide me with the pbix file. Remember not to log in to the current account when uploading files to Power Bi Desktop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 20 May 2024 07:40:22 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-05-20T07:40:22Z</dc:date>
    <item>
      <title>Subtract one column value to each column values in same row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-one-column-value-to-each-column-values-in-same-row/m-p/3929720#M152890</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; Hi All,&lt;/P&gt;&lt;P&gt;As per my business requirements I have to subtract current year (actual) column values to all the other column(MAR_FCST,PLAN, ACTUAL (2023)) values as shown in the matrix visuals. I am able to that for current year means current year actual column value I am able to subtract from current year mar_fcst, and plan and Actual. But not able to subtract current year actual column value to previous year actual column value.&lt;/P&gt;&lt;P&gt;I am getting correct results in the GTN% GS~&amp;nbsp;&lt;/P&gt;&lt;P&gt;For year 2024 columns.&lt;/P&gt;&lt;P&gt;Explanation is below:&lt;/P&gt;&lt;P&gt;I want to subtract 2024 ACTUAL column value which is 43.8% to other column that is&amp;nbsp;&lt;/P&gt;&lt;P&gt;(43.8-43.8) for plan and (42.8-43.8) for mar-fcst and (42.7-43.8) for plan and (40.9-43.8) for 2023 &lt;STRONG&gt;actual.&lt;/STRONG&gt; But I am not able to do that for&amp;nbsp;&lt;STRONG&gt;2023.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I am using below dax:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt; please help to guide me how to achieve this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for the time and guidance&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 May 2024 16:51:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-one-column-value-to-each-column-values-in-same-row/m-p/3929720#M152890</guid>
      <dc:creator>ShyamS</dc:creator>
      <dc:date>2024-05-18T16:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract one column value to each column values in same row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-one-column-value-to-each-column-values-in-same-row/m-p/3931723#M152968</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="707964" data-lia-user-login="ShyamS" class="lia-mention lia-mention-user"&gt;ShyamS&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can not help you very well by providing DAX syntax and data in the form of screenshots.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;For calculations involving this year and last year, it would be better to create a date table with all the dates in the main table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try syntax logic like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;MEASURE =
VAR _sameDayLastYear =
    DATE ( YEAR ( MAX ( 'Date'[Date] ) ) - 1, MONTH ( MAX ( 'Date'[Date] ) ), DAY ( MAX ( 'Date'[Date] ) ) )
VAR _lastYear =
    CALCULATE (
        SUM ( Table[ACTUAL] ),
        FILTER ( ALL ( 'Date' ), 'Date'[Year] = _sameDayLastYear )
    )
VAR _actual =
    SUM ( Table[ACTUAL] )
RETURN
    _lastYear - _actual&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please provide me with the pbix file. Remember not to log in to the current account when uploading files to Power Bi Desktop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2024 07:40:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Subtract-one-column-value-to-each-column-values-in-same-row/m-p/3931723#M152968</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-20T07:40:22Z</dc:date>
    </item>
  </channel>
</rss>

