<?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: Sum measure based on another measure value in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/928887#M9488</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="187581" data-lia-user-login="tjhoolahan" class="lia-mention lia-mention-user"&gt;tjhoolahan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure = 
var _lm = [Live Month]
RETURN
CALCULATE([Revenue],all('Date'),_lm = 4)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;I&gt;&lt;FONT color="#ababab"&gt;do not hesitate to give a kudo to useful posts and mark solutions as solution&lt;/FONT&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://linkedin.com/in/alekseizhukov" target="_blank"&gt;LinkedIn&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Feb 2020 17:33:12 GMT</pubDate>
    <dc:creator>az38</dc:creator>
    <dc:date>2020-02-11T17:33:12Z</dc:date>
    <item>
      <title>Sum measure based on another measure value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/928702#M9480</link>
      <description>&lt;P&gt;I have created a measure for the "live month number" of a client in our DB. This is an integer value that, for any selected month and client, will inform how many months the client has been live with one of our products.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then want to sum the revenue generated by that client for a specific month, in this case number 4, and always return that value, regardless of which month is selected or shown. The code is below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE([Revenue],[Live Month] = 4,all('Date'))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;The issue I'm having though is that the True/False expression is being used as a table filter expression, as per Calculate's requirements, and this isn't allowed. &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;How do I get around this, using only measures? I.e. how do I calculate the revenue for a client in month 4 of its cycle, using the measures "Revenue" and "Live Month"?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I have managed to do it by adding values to columns and applying Calculate accordingly but I'm trying to use Measures to restrict the size of the file and not replicate "Live Month" across multiple different tables...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 11 Feb 2020 15:24:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/928702#M9480</guid>
      <dc:creator>tjhoolahan</dc:creator>
      <dc:date>2020-02-11T15:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: Sum measure based on another measure value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/928887#M9488</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="187581" data-lia-user-login="tjhoolahan" class="lia-mention lia-mention-user"&gt;tjhoolahan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure = 
var _lm = [Live Month]
RETURN
CALCULATE([Revenue],all('Date'),_lm = 4)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;I&gt;&lt;FONT color="#ababab"&gt;do not hesitate to give a kudo to useful posts and mark solutions as solution&lt;/FONT&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://linkedin.com/in/alekseizhukov" target="_blank"&gt;LinkedIn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 17:33:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/928887#M9488</guid>
      <dc:creator>az38</dc:creator>
      <dc:date>2020-02-11T17:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: Sum measure based on another measure value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/928897#M9489</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="82403" data-lia-user-login="az38" class="lia-mention lia-mention-user"&gt;az38&lt;/a&gt;&amp;nbsp;- it still gives me an error, as per the image below. Am I doing something wrong? Are you expecting this to work because you are making it a variable (this is still a relatively new concept in PBI to me)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 17:40:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/928897#M9489</guid>
      <dc:creator>tjhoolahan</dc:creator>
      <dc:date>2020-02-11T17:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Sum measure based on another measure value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/928905#M9490</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="187581" data-lia-user-login="tjhoolahan" class="lia-mention lia-mention-user"&gt;tjhoolahan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sorry. try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure = 
var _lm = [Live Month]
RETURN
CALCULATE([Revenue],filter(all('Date'),_lm = 4))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;I&gt;&lt;FONT color="#ababab"&gt;do not hesitate to give a kudo to useful posts and mark solutions as solution&lt;/FONT&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://linkedin.com/in/alekseizhukov" target="_blank"&gt;LinkedIn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 17:46:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/928905#M9490</guid>
      <dc:creator>az38</dc:creator>
      <dc:date>2020-02-11T17:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Sum measure based on another measure value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/928910#M9491</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="82403" data-lia-user-login="az38" class="lia-mention lia-mention-user"&gt;az38&lt;/a&gt;&amp;nbsp;, thanks, I no longer get the error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I now don't get the correct output in the table. In image below, you'll see the value of "Adtech Revenue" in month 4 is 10060, whereas the "3m Gate (measure based approach)", which is the code you supplied, returns 61518.81 (I believe this is the total revenue ever) and only in month 4, not the rest.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can we a) somehow amend the measure so it returns the correct month 4 value? b) amend the measure so it returns the month 4 value in all months?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 17:56:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/928910#M9491</guid>
      <dc:creator>tjhoolahan</dc:creator>
      <dc:date>2020-02-11T17:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Sum measure based on another measure value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/928917#M9493</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="187581" data-lia-user-login="tjhoolahan" class="lia-mention lia-mention-user"&gt;tjhoolahan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;maybe you should just try to IF() in return?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure = 
var _lm = [Live Month]
RETURN
if(_lm=4,[Revenue],BLANK())&lt;/LI-CODE&gt;&lt;P&gt;?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;I&gt;&lt;FONT color="#ababab"&gt;do not hesitate to give a kudo to useful posts and mark solutions as solution&lt;/FONT&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 18:06:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/928917#M9493</guid>
      <dc:creator>az38</dc:creator>
      <dc:date>2020-02-11T18:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Sum measure based on another measure value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/939119#M9932</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="82403" data-lia-user-login="az38" class="lia-mention lia-mention-user"&gt;az38&lt;/a&gt;&amp;nbsp;- almost there. Only thing required now though is to be able to see that value (set as the month 4 value) for all months. In the image below, I've circled the dates which are currently blank that should be filled with 10400.54. Any ideas how to rectify this situation?&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 14:34:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/939119#M9932</guid>
      <dc:creator>tjhoolahan</dc:creator>
      <dc:date>2020-02-19T14:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: Sum measure based on another measure value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/939397#M9955</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="187581" data-lia-user-login="tjhoolahan" class="lia-mention lia-mention-user"&gt;tjhoolahan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;not sure I understand you correct, but maybe this&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure 2 = calculate('Adtech Revenue'[Adtech Revenue], filter(ALL('Adtech Revenue'),'Adtech Revenue'[Adtech Live Month]=4))&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 19 Feb 2020 17:26:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/939397#M9955</guid>
      <dc:creator>az38</dc:creator>
      <dc:date>2020-02-19T17:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sum measure based on another measure value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/941031#M10029</link>
      <description>&lt;P&gt;Probably you just need to make a small fix in the formula and it will work. Try this:&lt;/P&gt;&lt;P&gt;CALCULATE([Revenue],FILTER([Live Month],4,all('Date')))&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;CALCULATE([Revenue],IF([Live Month]=4))&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 14:24:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/941031#M10029</guid>
      <dc:creator>tlaurindo</dc:creator>
      <dc:date>2020-02-20T14:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: Sum measure based on another measure value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/943945#M10177</link>
      <description>Hm... I've been trying to understand what you need... but kill me - no chance.&lt;BR /&gt;&lt;BR /&gt;Maybe if you were more explicit and give some examples, it would make it digestible.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
      <pubDate>Sat, 22 Feb 2020 19:57:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/943945#M10177</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-22T19:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: Sum measure based on another measure value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/1059656#M14671</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="82403" data-lia-user-login="az38" class="lia-mention lia-mention-user"&gt;az38&lt;/a&gt;, thanks for your help and apologies for the delay in reply. In the end, attempting to do it through a measure proved too difficult and time consuming, so I simply added a calculated column to the relevant table. I will revisit at some stage in the future, as I believe the calculated column is causing a fairly large strain on my dataset, but, for now, I've delivered against my objective so can leave it for a bit.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 16:04:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-measure-based-on-another-measure-value/m-p/1059656#M14671</guid>
      <dc:creator>tjhoolahan</dc:creator>
      <dc:date>2020-04-30T16:04:04Z</dc:date>
    </item>
  </channel>
</rss>

