<?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 combine several measures into one in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-combine-several-measures-into-one/m-p/2861052#M92133</link>
    <description>&lt;P&gt;I have created several measures to calculate LTM sales, the result works perfectly well but my problem is that I only use the first measure to calculate the second, and the second to calculate the third:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure 1:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;CombinedColumn = CALCULATE( &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;'Sales'[Sales Amount] + [Remaining Budget]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure 2:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Combined LTM = CALCULATE(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;[CombinedColumn],&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;DATESINPERIOD( 'Date'[DateTime],MAX('Date'[DateTime]),-12,MONTH )&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Measure 3:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Budget LTM = &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;VAR LastDateWithSales = CALCULATE( MAX ( Sales[PostingDate]), REMOVEFILTERS())&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;VAR RB_LTM = CALCULATE(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;[Combined LTM],&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;KEEPFILTERS('Date'[DateTime] &amp;gt;= LastDateWithSales)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;RETURN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;RB_LTM&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica"&gt;I would really like to combine these three measures into one, this is my attempt at it:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Budget LTM = &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;VAR LastDateWithSales = CALCULATE( MAX ( Sales[PostingDate]), REMOVEFILTERS())&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;VAR CombinedColumn = CALCULATE( &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;'Sales'[Sales Amount] + [Remaining Budget]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;VAR CombinedLTM = CALCULATE(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;CombinedColumn,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;DATESINPERIOD( 'Date'[DateTime],MAX('Date'[DateTime]),-12,MONTH)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;VAR BudgetLTM = CALCULATE(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;CombinedLTM,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;KEEPFILTERS('Date'[DateTime] &amp;gt;= LastDateWithSales)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;RETURN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;BudgetLTM&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm fairly new to DAX, so I assume there is something relatively simple I'm missing.&lt;/P&gt;</description>
    <pubDate>Tue, 25 Oct 2022 07:57:30 GMT</pubDate>
    <dc:creator>kjel</dc:creator>
    <dc:date>2022-10-25T07:57:30Z</dc:date>
    <item>
      <title>How to combine several measures into one</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-combine-several-measures-into-one/m-p/2861052#M92133</link>
      <description>&lt;P&gt;I have created several measures to calculate LTM sales, the result works perfectly well but my problem is that I only use the first measure to calculate the second, and the second to calculate the third:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure 1:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;CombinedColumn = CALCULATE( &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;'Sales'[Sales Amount] + [Remaining Budget]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure 2:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Combined LTM = CALCULATE(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;[CombinedColumn],&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;DATESINPERIOD( 'Date'[DateTime],MAX('Date'[DateTime]),-12,MONTH )&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Measure 3:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Budget LTM = &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;VAR LastDateWithSales = CALCULATE( MAX ( Sales[PostingDate]), REMOVEFILTERS())&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;VAR RB_LTM = CALCULATE(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;[Combined LTM],&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;KEEPFILTERS('Date'[DateTime] &amp;gt;= LastDateWithSales)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;RETURN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;RB_LTM&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica"&gt;I would really like to combine these three measures into one, this is my attempt at it:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Budget LTM = &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;VAR LastDateWithSales = CALCULATE( MAX ( Sales[PostingDate]), REMOVEFILTERS())&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;VAR CombinedColumn = CALCULATE( &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;'Sales'[Sales Amount] + [Remaining Budget]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;VAR CombinedLTM = CALCULATE(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;CombinedColumn,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;DATESINPERIOD( 'Date'[DateTime],MAX('Date'[DateTime]),-12,MONTH)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;VAR BudgetLTM = CALCULATE(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;CombinedLTM,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;KEEPFILTERS('Date'[DateTime] &amp;gt;= LastDateWithSales)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;RETURN&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;BudgetLTM&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm fairly new to DAX, so I assume there is something relatively simple I'm missing.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 07:57:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-combine-several-measures-into-one/m-p/2861052#M92133</guid>
      <dc:creator>kjel</dc:creator>
      <dc:date>2022-10-25T07:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine several measures into one</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-combine-several-measures-into-one/m-p/2863053#M92233</link>
      <description>&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;VARiables in DAX are static.&lt;/STRONG&gt;&lt;/FONT&gt; They are in fact constants so there's no point doing something like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var Variable = ...&lt;/P&gt;
&lt;P&gt;return&lt;/P&gt;
&lt;P&gt;calculate(&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Variable,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; ...&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will always return the value of the Variable as it was calculated in the first line...&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 01:15:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-combine-several-measures-into-one/m-p/2863053#M92233</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-10-26T01:15:14Z</dc:date>
    </item>
  </channel>
</rss>

